Inkscape inx param defaults - inkscape

I am developing a extension for Inkscape and would like to set a param value based on a value that is set on a object. For example if the ID of the selected object is set to "myRect" how would I display that value in the extension dialog? Seems to me that there should be a way to tell Inkscape that I want a value displayed here from attribute "id", I have read through the documentation on Inkscapes wiki and searched the web but couldn't find any answers.

I don't think it's possible.
The extension UI is built from the static .inx file. There's no way for your extension code to modify that AFAIK.
It might be possible to have your extension rewrite the .inx file all the time. But I imagine that this would be a horrible horrible approach. Also I'm not sure how frequently inkscape reloads the .inx file.

Related

Django - suing font awersome in unicode form

I want to use font awersome in my project in the way, that user can choose which icon he wants. I found django-fontawesome-5 but there is one problem - there is no access to icon's unicode and I need it for one javascript component (html doesn't work there, and unicode does). I was looking all over the internet, but I coundn't find anything that would allow me to add font-awersome icons, with their unicodes somhow stored. My question is do you know how to get this feature?
The unicode codes are stored in icons.json and in icons_semantic_ui.json
Since you've got the codes source you can define a custom templatetag or a model/mixin method or a function which just gets a code from one of those json files using icon name
You can see example in fontawesome_5/utils.py

Can I use a variable as a text property when calling class window?

I have a child object class window with a parameter regexptitle, so text being changed dynamically depending on the regular expression. I need to check if this window is opened and active using variable. I tried to put there string but it didn't help. Please help me find a solution.
Example of code repeated:
If Window("Excel").Window("Prompts for Project Analysis"). Exist Then ...
If Window("Excel").Window("Prompts for Engagements"). Exist Then ...
Assuming I read your question correctly, you should be able to achieve the goal using descriptive programming with this:
If Window("Excel").Window("regexptitle:=Prompts for.*"). Exist Then
Or if you have at least one version of the window learned in the object repository, add the regexptitle property to the test object details under Description properties, set it to a regular expression and set its value to be "Prompts for.*" - this will cause UFT to recognise all windows of this class with a regexptitle beginning "Prompts for" as this object (assuming the other recognition properties match up as well, and you get to use the OR-friendly object name in your code.
Let me know if that works for you, or if you need further help.

how to access image property list and manipulate in MITK

I am developing a plugin for MITK, which is a tookit for medical imaging. I want to access the full path of image that is loaded in the data manager.
There are properties of images like name, opacity, path etc.
I searched MITK documentation but I could not find any proper information related to that.
Can you please help me?
If you want to see the 'path' in the UI, you can use the Properties plugin, available in the MITK Workbench and in your own app if you decided to include it.
If you want to access the content of the 'path' property in the code, then you need a mitk::DataNode in the current scope, because properties are usually related to node.
std::string path;
node->GetStringProperty("path", path);
Note that this won't give you the full path though. For some reason, MITK decided to remove the extension in this property, thus giving something like D://Data/brain instead of the D://Data/brain.nii.gz that I wanted.
AFAIK, there's currently no 100% safe way to get the real full path in MITK, but one could easily search on the file system using path + ".*" and hoping that it returns only one result :)
The property is not on the DataNode but in the BaseData in it. There is a 'path' property there. You can see its value when right-click the image and selecting 'details'

Get app icon URL in Qt on Linux

I am trying to get the icon of an app (doesn't matter which one). I noticed Qt doesn't have something like GDesktopAppInfo and therefore I tried getting it through QSettings from /usr/share/applications/appname.desktop. That's already a problem, because the desktop file might not be there. Anyway, going further to extract the Icon key. Now I dunno how to find the url (notice that I need the url, sure I could make a QIcon, but I need to export it to QML, which would mean another QQuickImageProvider class, anyway, I don't wanna go that way). Is it possible, or is the aforementioned QQuickImageProvider my only solution?
Here is a little guide that might help you find your way. Keep one thing in mind: start with the basic case, get code running and extend it to more difficult cases later.
For now, lets assume the following:
.desktop file is in /usr/share/applications
App icon is in SVG or PNG format
App icon path is absolute
App name is lower case and does not contain whitespace
Input: App name "git-cola"
Read /usr/share/applications/git-cola.desktop
Use a QRegularExpression to get the Icon value
You get an absolute iconPath, e.g. /usr/share/git-cola/icons/git.svg
Have an invokable C++ function that exposes a QUrl to QML
In QML, set the source property of an Image to getIconUrl("Target App")
where 4. looks something like
QUrl MyClass::getIconUrl(QString appName)
{
// get iconPath from appName
return QUrl::​fromLocalFile(iconPath);
}
If things are running, you can add support for
Multiple .desktop locations (there might be a handful or so)
Add support for relative paths
Add support for XPM files
You can use QIcon::fromTheme(QString iconName) to find the icon. It works most of the time but it's not as reliable as gtk

How can I know which themepack is applied on my system?

Normally when we double click on a themepack file it is applied on our system and a corresponding folder with the same name as the themepack is saved in
C:\Users\<username>\AppData\Local\Microsoft\Windows\Themes
Now if I have multiple themepack files and I have applied each of them at least once, then all the themepacks will have a corresponding folder in the Themes folder. Now I want to know which particular theme is applied on my machine, programmatically.
(When we use a themepack file Custom.theme file is not updated)
I'm pretty sure there's no API that can retrieve that information. Which makes sense, it isn't really relevant. An application never needs to know the name of the theme pack that the user selected.
What you can get using an API, and what is useful, is the name and properties of the theme that the user has enabled. For example, calling the GetCurrentThemeName() function and/or the GetThemeDocumentationProperty() function.aspx) with SZ_THDOCPROP_DISPLAYNAME will tell you whether the user has enabled the Aero theme or not. Or if they're using a custom theme that is not Aero. Just to be sure, though, I tested it, and neither of those functions returns the name of my currently selected theme pack.
However, you can read the registry to obtain the information you desire. Find it in the following location:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\CurrentTheme
That value will contain a string corresponding to the full path to the currently selected theme pack, e.g.:
C:\Users\billg\AppData\Local\Microsoft\Windows\Themes\Pink Polka Dots.theme
If you want, you can strip out the path spec and extension, using just the file name as the name of the theme pack, e.g. Pink Polka Dots.
But that isn't a complete solution because it doesn't take localization into account. Especially with system-provided theme packs, the file name is going to be in English, but the name of the theme pack is going to be localized in the UI. The user sees something different when they pick themes.