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 )
Related
Is there a way to read the properties from file in wso2 using property mediator?
I'm injecting an address uri from the file.properties, and passing the file path as -Dproperties.file.path argument to the startup script, it is able to resolve the varibale only within the address endpoint's uri attribute using the syntax $FILE:variableName as below:
<call>
<endpoint>
<address uri="$FILE:uploadPath">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
</call>
But I also have the need to use the same property, do a minor transformation and pass it to a class mediator,
I've tried the below approaches and none of them are working.
<log level="custom">
<property expression="$FILE:uploadPath" name="file-path-1"/>
<property expression="$ctx:uploadPath" name="file-path-2"/>
<property expression="$axis2:uploadPath" name="file-path-3"/>
<property expression="$trp:uploadPath" name="file-path-4"/>
<property expression="$axis2:POST_TO_URI" name="POST_TO_URI"/>
</log>
Below are the versions of OS and tools that I'm using.
OS: Mac os catalina,
WSO2: micro-integrator 1.2.0, Integration sutdio - 7.1.0
Some time ago, i was struggling with similar issue, to try using $FILE: in dockered microintegrator . After checking sourcecode i realized that there is no implemented reading in property mediator, and that works only in endpoints... I belive that is because of security reason?
But, there is some workaround, which I'm not a big fan. You could use Property and ScriptMediator:
<property xmlns:ns="http://org.apache.synapse/xsd" name="propPath" expression="get-property('system','properties.file.path')" scope="default" type="STRING"/>
<script language="js"><![CDATA[
var path = java.nio.file.Paths.get(mc.getProperty('propPath'));
var fromFile = java.nio.file.Files.readAllLines(path, java.nio.charset.StandardCharsets.UTF_8);
mc.setProperty('line1',fromFile.get(0).toString());
mc.setProperty('line2',fromFile.get(1).toString());
]]></script>
Of course you got full line, but if you tweak this ScriptMediator, you can have what you want in separate properties.
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.
When I try to create an LDAP Base user store in WSO2 IS 5.3.0 I always get the following error:
TID: [-1234] [] [2017-04-03 11:40:49,521] ERROR {org.wso2.carbon.identity.user.store.configuration.UserStoreConfigAdminService} - Error occurred during the transformation process of C:\WSO2IS~1.0\bin\..\repository\deployment\server\userstores\myUserStore.xml
org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException: Error occurred during the transformation process of C:\WSO2IS~1.0\bin\..\repository\deployment\server\userstores\myUserSotre.xml
I have tried previous version and it fails till 5.0.0, in which I succeed in create the user store. User store config in WSO2 ESB seems to works the same way that WSO2 IS user store, so, I configured the user store in WSO2 ESB, and copy the myUserSotre.xml generated by WSO2 ESB just in the same path where IS failed to find the file.
That worked, and result in WSO2 IS recognizing the User Store. I can see the users from the user store in WSO2 IS user store. However, if I try update the "forced" user store, it keeps throwing the error.
I am using windows 7 and jdk 8.
This is the xml from ESB and IS 5.0.0 that works if I paste it in IS 5.3
<?xml version="1.0" encoding="UTF-8"?>
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">
<Property name="ConnectionName">cn=Manager,dc=company,dc=com</Property>
<Property name="ConnectionURL">ldap://IP:HOST</Property>
<Property name="ConnectionPassword">password</Property>
<Property name="UserSearchBase">ou=People,dc=company,dc=com</Property>
<Property name="Disabled">false</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="UserNameSearchFilter">(&(objectClass=person)(uid=?))</Property>
<Property name="ReadOnly">true</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="ReadGroups">false</Property>
<Property name="GroupSearchBase">ou=system</Property>
<Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=groupOfNames)(cn=?))</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>
<Property name="MemberOfAttribute"/>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="ReplaceEscapeCharactersAtUserLogin">true</Property>
<Property name="DomainName">ldap</Property>
<Property name="Description"/>
</UserStoreManager>
Is there any issue about this? Is there extra configuration needed?
This happens in Windows because of the file path encoding. Currently this is not fixed from WSO2 side. As a work around, you can rename WSO2IS~1.0 folder not contain the '~' character. eg. rename it with WSO2IS and try.
The solution is simple. Set environment variable CARBON_HOME to the path of your wso2 IS folder.
Mainly that's the question here. In a previous attempt I tried to accomplish this by making some funcs, activating and de-activating a switch, etc, but with no good results.
You can see my previous question here:
Previous question here on StackOverflow
I want to do this:
User runs program --> Tries to activate Switch --> Program detects exception --> Don't close entire program, just deactivate switch again as if user hadn't touched it
My previous code was able to accomplish only when the switch was "Off".
I want this to work in both states (ON & OFF)
If user wants to turn switch OFF (It Was ON), and program detects an exception, turn switch ON automatically again, like if nothing happend & vice versa
I'm using Python2.7, Glade to design GUI, Gtk 3.4 and Ubuntu 14.04.5 as my OS
In this new question I'm asking for some help solving this.I've done research and I've wrote code earlier, but MY code won't work at all. (You can see it in my previous Question)
I need someone to contribute with some new piece of fundamental code just to make this work, because I've tried all I know and just nothing.If you're asking yourself why I didn't provide any code, it's because I'm trying to force people to answer totally new pieces of code.
Why? Maybe because my previous code was kinda faulty, or something that maybe was blocking it. I'M NOT ASKING PEOPLE TO WRITE DOWN MY ENTIRE PROGRAM, in fact this isn't the entire program, it's just a tiny piece of it
Thanks anyways.
EDIT: Here's my actual code
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import os
import subprocess
import sys
import subprocess
import signal
import time
from subprocess import call
import threading
from multiprocessing import Process
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf
builder = Gtk.Builder()
#builder.add_from_file("""./Testing2.glade""")
builder.add_from_string("""
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.2"/>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="halign">baseline</property>
<property name="valign">baseline</property>
<property name="title" translatable="yes">Test</property>
<property name="resizable">False</property>
<property name="window_position">center</property>
<property name="icon_name">applications-accessories</property>
<property name="urgency_hint">True</property>
<property name="has_resize_grip">False</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_left">24</property>
<property name="margin_right">24</property>
<property name="margin_top">24</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
<property name="spacing">16</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">applications-games</property>
<property name="placeholder_text" translatable="yes">Texto</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
""")
window1 = builder.get_object('window1')
textie = builder.get_object('entry1')
switchie = builder.get_object('switch1')
def TurnOn(switch, active):
print switchie.get_active()
if yay == "":
switchie.set_active(not switchie.get_active())
def TurnOff(switch, active):
print switchie.get_active()
if yay == "":
switchie.set_active(not switchie.get_active())
def ParentTrue(switch,active):
yay = textie.get_text().rstrip()
if yay == "":
def Hi():
print switchie.get_active()
switchie.handler_block(connecting)
switchie.set_active(False)
switchie.handler_unblock(connecting)
return True
Hi()
def ParentFalse(switch,active):
yay = textie.get_text().rstrip()
if yay == "":
def Hi():
print switchie.get_active()
switchie.handler_block(connecting)
switchie.set_active(True)
switchie.handler_unblock(connecting)
return True
Hi()
switchie.set_active(True)
def qck():
while True:
os.environ["SomeVar"] = str(switchie.get_active())
p1 = threading.Thread(target=qck)
p1.start()
if not os.environ["SomeVar"]:
connecting = switchie.connect('notify::active', ParentFalse)
if os.environ["SomeVar"]:
connecting = switchie.connect('notify::active', ParentTrue)
window1.set_position(Gtk.WindowPosition.CENTER)
window1.connect("delete-event", Gtk.main_quit)
window1.show_all()
if __name__ == '__main__':
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
Gtk.main()
This code just works from OFF to ON. It won't work when you change from ON to OFF
Example:
If I execute this code, and try to activate switch WITHOUT entering text first, It won't change, BUT if you enter text (It doesn't matter, just enter a single letter if you want) it will allow you to move the switch from OFF to ON. Unfortunately It won't do anything special if you want to move switch from ON to OFF even if you try to do so without entering text first
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