I know how to do this in Python or C but I do not manage to do this in Glade:
self.reclamaTaAiciLinkButton =\
self.get_object("reclamaTaAiciLinkButton")
self.reclamaTaAiciLinkButton.set_label("RECLAMA TA AICI")
This is a screenshot with all the available specific properties for the GtkLinkButton type in Glade:
If it is possible somehow by using the "Action Name" field, please give me an example. If it is possible by editing the Glade .ui file using a text editor, that would be better than nothing.
I have found this pretty old bug in the official issue tracker of the Glade project which is entirely about this.
In the .ui file opened with a text editor you might have a fragment similar to this one, where a GtkLinkButton is declared and defined:
<object class="GtkLinkButton" id="reclamaTaAiciLinkButton">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="uri">https://www.patreon.com/SilviuBogan</property>
<style>
<class name="reclamaTaAiciLinkButton"/>
</style>
</object>
The important part is this:
<property name="label" translatable="yes">button</property>
If you close the .ui file in Glade, open the .ui file in a text editor (preferably an XML file editor) and then replace the contents of this <property> element from "button" to something else, then you save the file and reopen it in Glade, you see that in the Glade designer, the new label is visible. If you start the program that loads this .ui file, you will see that the changes are working.
Related
I have run into peculiar problem. Did a lot of research but cannot find even a hint what can I try to do to fix the problem.
What I did is to write a very simple example that uses glade to render application main view. I tried this on Linux ubuntu and then planned to port the code to Windows using msys2 and mingw32. Example is written in GTKmm2 (C++ GTK2 (not GTK3)) After a lot of struggle to port I have managed to compile example under windows.
Result is as follows (since it is hard to describe I include picture):
https://imgur.com/WkoiN3v
This is how it looks when application is started from mingw32 terminal window.
Now, I try to 'export/deploy' the app in another part of windows where I intended to use it. Basically trying to make POC of deployment.
After ordial of finding all relevant .dlls and supporting files in deployment application starts but fonts are not rendering properly.
When I run app from windows command line I get this:
https://imgur.com/PWZloIr
I tried to toy with ~/.gtkrc-2.0 (as previously using it for python gtk+) and try to set default gtk font to something available in windows, but it seem not to have any effect on font rendering.
What else I can try to do ?
As suggested ... Code:
main.cxx
// #include <gtkmm.h>
#include <gtkmm-2.4/gtkmm.h>
Gtk::Window* window;
static void on_q_button_clicked()
{
if(window)
window->hide(); //hide() will cause main::run() to end.
}
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("basic.glade");
builder->get_widget("window1", window);
Gtk::Button* pButton = 0;
builder->get_widget("button1", pButton);
if(pButton)
{
pButton->signal_clicked().connect( sigc::ptr_fun(on_q_button_clicked) );
}
Gtk::Main::run(*window);
return 0;
}
basic.glade
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="default_width">440</property>
<property name="default_height">250</property>
<property name="destroy_with_parent">True</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Yes!
Always
This is just a text</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">click me to close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
that's about all source that there is. It's a kind of 'hello world' code just to test concept end to end, before writing intended application.
I managed to get font rendering working, by some lateral thinking, but I am still puzzled what to do.
Due the specifics of the setup (enterprise constrains) I thought that USERPROFILE or HOMEDRIVE or HOMEPATH are playing a role (because of ~/.gtkrc-2.0 settings). But it turned out that it is not making any influence.
Font rendering comes correct when I add path to mingw32 bin folder. So:
SET path=C:\path\to\mingw32\bin;%path%
Then, application shows fonts properly. I believe that after this intervention, font settings in ~/.gtkrc-2.0 start working too.
However, this still do not make full deployment to the target machine proper, as I still do not know what file (dynamic library or
executable) is needed from \mingw32\bin folder to render fonts at
the target. I would like not to be dependent on installing mingw at
the target machine just for the sake of running the application.
But it is a step forward :)
Update:
figured out 2 more libraries expected to be included in deployment, but still not enough to fix the font issue. Following libraries shall be reachable by main.exe that are found in bin folder:
libgdk-win32-2.0-0.dll
libgtk-win32-2.0-0.dll
full list of dynamic libraries that shall be accessible is:
libatk-1.0-0.dll
libatkmm-1.6-1.dll
libbz2-1.dll
libcairo-2.dll
libcairomm-1.0-1.dll
libffi-6.dll
libfreetype-6.dll
libgcc_s_dw2-1.dll
libgdk-win32-2.0-0.dll
libgdkmm-2.4-1.dll
libgio-2.0-0.dll
libgiomm-2.4-1.dll
libglib-2.0-0.dll
libglibmm-2.4-1.dll
libgobject-2.0-0.dll
libgraphite2.dll
libgtk-win32-2.0-0.dll
libgtkmm-2.4-1.dll
libharfbuzz-0.dll
libiconv-2.dll
libintl-8.dll
libpango-1.0-0.dll
libpangomm-1.4-1.dll
libpcre-1.dll
libpixman-1-0.dll
libpng16-16.dll
libsigc-2.0-0.dll
libstdc++-6.dll
libwinpthread-1.dll
zlib1.dll
And, confirmed: styling, font selection and font size user customization works from ~/.gtkrc-2.0 properly when path is set.
( For people who do not get unix idioms '~/' means your user folder. On windows (e.g. windows 7) this will be c:\Users\YourWindowsUserName therefore customization file on windows is: c:\Users\YourWindowsUserName.gtkrc-2.0 )
I'm building a QGIS plugin with Python and designed a GUI for it. I can compile it with pyuic4, but on load it gives an error. I found out that I can prevent that error by adding the line below in the compiled Python code. Only at some moments I have to recompile and so the file gets overwritten and the line is lost.
form.py
from qgis.gui import QgsMapLayerComboBox
I have a 'parent' file which imports the compiled version like so:
dialog.py
from form import Ui_Dialog
Is there some way to import the QgsMapLayerComboBox in dialog.py so I don't have to add it every time to form.py after I recompiled my GUI?
EDIT:
<widget class="QgsMapLayerComboBox" name="mMapLayerComboBox">
<property name="geometry">
<rect>
<x>100</x>
<y>18</y>
<width>160</width>
<height>22</height>
</rect>
</property>
<property name="filters">
<set>QgsMapLayerProxyModel::RasterLayer</set>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>QgsMapLayerComboBox</class>
<extends>QComboBox</extends>
<header>qgsmaplayercombobox.h</header>
</customwidget>
</customwidgets>
Open your form.ui with some text editor and replace:
<customwidget>
<class>QgsMapLayerComboBox</class>
<extends>QComboBox</extends>
<header>qgsmaplayercombobox.h</header>
</customwidget>
with
<customwidget>
<class>QgsMapLayerComboBox</class>
<extends>QComboBox</extends>
<header>qgis.gui</header>
</customwidget>
and compile again.
I try to configure a Checkstyle rule to show me Tests marked with a specific TestGroup named FIXME to identify how many of such tests there are (to keep them tracked).
A typical test method looks like this:
#Test(groups = {TestGroups.GAMEHISTORY, TestGroups.FIXME}, description = "Some descriptive text...")
public void navigateThroughGameHistory() throws Exception {
PlayerDTO player = ghHelper.createConfirmedPlayerAndPayIn(TestBase.LANGUAGE);
... some more code ...
}
I tried my very best with various CheckStyle rules (RegExp with Single & Multiline, RegExpJava etc.), but it seems the Checkstyle does not parse lines containing annotations.
The simplest way to find an occurrence of FIXME to me seems the following:
<module name="Regexp">
<property name="severity" value="warning"/>
<property name="format" value=".*FIXME.*"/>
<property name="illegalPattern" value="true"/>
<property name="duplicateLimit" value="-1"/>
<property name="errorLimit" value="100"/>
<property name="ignoreComments" value="false"/>
<property name="message" value="Keep track of the FIXME-Tests!"/>
</module>
However, this does not work. However, if I change the format line to
<property name="format" value=".*player.*"/>
, I get one occurrence. I believe Checkstyle doesn't check Annotated Lines of Code by default - but I could not find any evidence for it.
But maybe my RegEx is just incorrect (simple as it is)?
I am desperate, because I am sure there is a simple solution, but I just can't find it..
Any help greatly appreciated!
Thanks in advance,
Jan
I have that line of codes at my jetty-servlet-context.xml
<bean id="jerseyServletCtx" class="org.eclipse.jetty.servlet.ServletContextHandler">
<property name="displayName" value="Jersey Servlet Context"/>
<property name="contextPath" value="/rest"/>
<property name="sessionHandler">
<bean class="org.eclipse.jetty.server.session.SessionHandler"/>
</property>
...
How can I add an ability to set maxInactiveInterval into my xml file? Maybe I am missing something it may be anywhere else instead of that jerseyServletCtx, but it should be at jetty-servlet-context.xml. Any ideas are welcome.
PS: I don't have a web.xml
Your question is almost a year old, but in case it might help you or someone else: you may want to review webdefault.xml and check the session-timeout element within the session configuration section.
I have just started learning Qt and I am trying to create a simple widget using this QUiLoader. But I am getting this error : "Designer: An error has occurred while reading the UI file at line 1, column 0: Premature end of document."
#include <QtGui/QApplication>
#include <QtUiTools/QUiLoader>
#include <QFile>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QUiLoader loader;
QFile file(":/aks.ui");
file.open(QFile::ReadOnly);
QWidget *myWidget = loader.load(&file);
if(myWidget){
myWidget->show();
}
return a.exec();
}
I constructed the ui file using QtCreator 2.4.1 and I am on Qt 4.7.4. Check out the ui file too.
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>131</width>
<height>129</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>A</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>B</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>C</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>D</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_5">
<property name="text">
<string>E</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
My project file:
#-------------------------------------------------
#
# Project created by QtCreator 2012-05-21T19:48:31
#
#-------------------------------------------------
QT += core gui
TARGET = Example
TEMPLATE = app
SOURCES += main.cpp \
sortdialog.cpp
HEADERS += \
sortdialog.h
FORMS += \
sortdialog.ui \
aks.ui
CONFIG += uitools
You need to add your .ui file to the resources of your project. Resources are files which get "compiled inside" of your app and are then available to Qt classes by file paths starting with ":/".
In order to add resources to your project, you need to create a resource file listing the files you want to register as resources. This file will be another XML file and can be created and edited by QtCreator. In the project manager, add another file and select the type Qt -> Qt resource file from within the dialog.
In your .pro file then appears a section:
RESOURCES += \
resources.qrc
In the resource file you need to add a prefix; just name it / (or leave it empty). Within this prefix you can add the file aks.ui so it will be named :/aks.ui.
Note that this type of UI creation takes place in runtime. That means, it is more flexible (maybe the ui file gets created only at runtime), but a little bit slower (since parsing and some more runtime processing takes place).
If you're new to Qt, you probably don't know that you can also let Qt create a class file for your ui file in the build process. This is already done when you list your ui file in the pro file in the FORMS += section.
To use the automatically built class, you should also have created a designer form class, which is another class where you put your own code inside. This class will load the automatically built class to setup your ui.
So there are two classes:
* The automatically generated class for your ui file, called Ui::Aks (in a namespace Ui), found in the file ui_aks.h in the build folder.
* Your own wrapper class; the acutal widget class, which uses the ui class.
If you want to create the second class manually, you can write (QtCreator actually does exactly this step when you add a designer form class instead of only a designer form):
aks.h:
#ifndef AKS_H
#define AKS_H
#include <QWidget>
namespace Ui {
class Aks; // <-- this is the automatically created ui class which we need
}
class aks : public QWidget // <-- your own widget class using the designer UI
{
Q_OBJECT
public:
explicit Aks(QWidget *parent = 0);
~Aks();
private:
Ui::Aks *ui; // <-- instance of the automatically created ui class
};
#endif // AKS_H
aks.cpp:
#include "aks.h"
#include "ui_aks.h" // <-- include the automatically generated ui class
Aks::Aks(QWidget *parent) :
QWidget(parent),
ui(new Ui::Aks)
{
ui->setupUi(this); // <-- here, the widgets from the ui file get created
}
Aks::~Aks()
{
delete ui;
}