GTK app with scrolled window crashing trying to show a widget inside

2011-12-30 Thread Moritz Renftle
Hi,

I'm programming a gtk-app with python and pygtk.
my app consists of a gtk.scrolledwindow and several widgets packed into
it horizontally. i want to make one of those widgets visible from
another thread (when a button is pushed on a joystick).
therefore i get the allocation of the widget and the adjustment of the
scrolledwindow and make use of the gtk.Adjustment.clamp_page function to
make sure the widget is visible on the page.

def set_focus(self):
adjust = self.scrolled_window.get_hadjustment()
x_pos = float(self.allocation.x)
x_pos_width = float(self.allocation.x + self.allocation.width)
adjust.clamp_page(x_pos, x_pos_width)

this works fine for sometime, but then some parts  of the window are not
repainted properly and the app crashes with a X Window System Error:
it's not always the same Error but one of those:
"BadDrawable", "BadIDChoice", "RenderBadPicture"...
I guess that there is a problem with gtk.main() not knowing it has to
refresh some areas of the window But I'm pretty desperate here!

Any help is very appreciated,
Moritz Renftle
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK app with scrolled window crashing trying to show a widget inside

2012-01-02 Thread Moritz Renftle
Thank you very much for your immediate response, this resolved my
problem!

Am Freitag, den 30.12.2011, 10:08 -0700 schrieb Michael Torrie:
> On 12/30/2011 05:52 AM, David Nečas wrote:
> > On Fri, Dec 30, 2011 at 01:28:32PM +0100, Moritz Renftle wrote:
> >> i want to make one of those widgets visible from
> >> another thread
> > 
> > Use glib.idle_add() in that other thread to subsequently execute the
> > actual Gtk+ code in the thread running the Gtk+ main loop.
> 
> http://unpythonic.blogspot.com/2007/08/using-threads-in-pygtk.html
> 
> It used to be that threading issues came up every week on the list.  As
> David says, the recommended way is using idle_add.  However if you use
> gdk locks appropriately, on Linux you can call Gtk calls directly from
> threaded code.
> 
> http://www.pardon-sleeuwaegen.be/antoon/python/page0.html
> 
> But since this won't work so well on Windows, the idle_add() technique
> is recommended as it is most safe and most portable.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Make a Gtk.Switch-widget show an arrow?

2012-02-25 Thread Moritz Renftle
Hi there,

i'm developing a software that is able to control the model railroad via
gamepad. i use python with pygobject.
now i need to find a widget that represents the direction of the train.
currently i do this with a Gtk.Button showing a Gtk.Arrow, but this is a
bit fuzzy:
http://imagepaste.nullnetwork.net/viewimage.php?id=3361
i'd like to use a more obvious representation and i thought of something
like that:
http://imagepaste.nullnetwork.net/viewimage.php?id=3360 .
but i dont really know how to implement sth like this. is it possible to
replace the text with a pixmap?

help and other suggestions are appreciated!
moritz

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Implementing a custom signal with PyGObject

2012-07-06 Thread Moritz Renftle
hi!

i'm trying to create a custom signal for a file-selection-button, code
is here: http://bpaste.net/show/DZwtKCPDBcpCv0g0NQCn/

the problem:
when the signal is emitted in the image_selection-method, it doesn't
call the connected signal handler, if this handler is not within the
same class. but if i connect the signal with a method in the same class,
it works.

is this a pygi-related bug or am i doing something wrong?

thanks in advance,
moritz

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Implementing a custom signal with PyGObject

2012-07-07 Thread Moritz Renftle
Hi Simon,

the problem was actually in my code and not in GObject or Gtk, what i
posted is working.
thanks for pointing out the problem of multiple inheritance from GObject
and Gtk.Button, it was just a try to see if it changes anything.

thank you,
moritz

Am Freitag, den 06.07.2012, 14:59 -0700 schrieb Simon Feltman:
> Hi Moritz,
> A good thing to do would be to pair your example down into something
> runnable from a console without any dependencies except GObject and
> Gtk if possible. Anyone helping will have to do this anyway in order
> to observe the problem. However, something that immediately stuck out
> in the code, and I'm not sure if it's a problem, is deriving from both
> Gtk.Button and GObject.GObject. I don't think this is needed because
> GObject is already a parent class of Gtk.Button.
> 
> 
> -Simon
> 
> On Fri, Jul 6, 2012 at 9:26 AM, Moritz Renftle
>  wrote:
> hi!
> 
> i'm trying to create a custom signal for a
> file-selection-button, code
> is here: http://bpaste.net/show/DZwtKCPDBcpCv0g0NQCn/
> 
> the problem:
> when the signal is emitted in the image_selection-method, it
> doesn't
> call the connected signal handler, if this handler is not
> within the
> same class. but if i connect the signal with a method in the
> same class,
> it works.
> 
> is this a pygi-related bug or am i doing something wrong?
> 
> thanks in advance,
> moritz
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 
> 


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Howto make a Gtk.Buttonbox look like the path bar in Gtk.FileChooserDoalog?

2012-09-03 Thread Moritz Renftle
Hi,

I recently noticed the nice appearance of the path bar widget in the
GtkFileChooserDialog:
http://imagepaste.nullnetwork.net/viewimage.php?id=4889
This look is also used for the top bar in the new GNOME system-settings.

I was wondering whether there is an easy way to turn a GtkButtonBox into
something with this look. At the moment, the ButtonBox in my
python-Gtk3-app looks like this:
http://imagepaste.nullnetwork.net/viewimage.php?id=4890

But I'd like to remove the vertical gap between the buttons in the
ButtonBox and have the nice rounded corners like in the path bar widget.
I tried to find the source code of the path bar but i failed reading the
c-code.

Is there a simple way to achieve this or would i have to implement my
own widget?

Thanks in advance for your help,
Moritz Renftle




___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Howto make a Gtk.Buttonbox look like the path bar in Gtk.FileChooserDoalog?

2012-09-03 Thread Moritz Renftle
I made a quick mockup to show you my idea:
http://imagepaste.nullnetwork.net/viewimage.php?id=4897

Am Montag, den 03.09.2012, 11:57 +0200 schrieb Moritz Renftle:
> Hi,
> 
> I recently noticed the nice appearance of the path bar widget in the
> GtkFileChooserDialog:
> http://imagepaste.nullnetwork.net/viewimage.php?id=4889
> This look is also used for the top bar in the new GNOME system-settings.
> 
> I was wondering whether there is an easy way to turn a GtkButtonBox into
> something with this look. At the moment, the ButtonBox in my
> python-Gtk3-app looks like this:
> http://imagepaste.nullnetwork.net/viewimage.php?id=4890
> 
> But I'd like to remove the vertical gap between the buttons in the
> ButtonBox and have the nice rounded corners like in the path bar widget.
> I tried to find the source code of the path bar but i failed reading the
> c-code.
> 
> Is there a simple way to achieve this or would i have to implement my
> own widget?
> 
> Thanks in advance for your help,
> Moritz Renftle
> 
> 
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Re: Howto make a Gtk.Buttonbox look like the path bar in Gtk.FileChooserDoalog?

2012-09-03 Thread Moritz Renftle
hi olivier,

i spent the whole evening looking through the source of
gtkfilechooserwidget and finally found a source file named
"gtkpathbar.c":
http://fossies.org/dox/gtk+-3.4.4/gtkpathbar_8c_source.html
it's a widget called gtkpathbar and exactly the one which is used in
gtkfilechooserwidget.

I found out it consists of several GtkToggleButtons which are packed
into a container. but i'm so bad at reading C (used to python only :/ )
that i still couldn't find the "trick" that is used in this code to put
the buttons together with round corners only for the buttons at the
side.

i also tried out if there is a thing like Gtk.PathBar.new() in python
but it seems like the PathBar-widget is meant to be used for the
filechooserdialog only.

if you could help me finding the "magic" lines that do the trick, i
would be very happy!

thank you for your effort,
moritz

Am Montag, den 03.09.2012, 19:15 +0200 schrieb Olivier Sessink:
> On 09/03/2012 11:57 AM, Moritz Renftle wrote:
> > Hi,
> > 
> > I recently noticed the nice appearance of the path bar widget in the
> > GtkFileChooserDialog:
> > http://imagepaste.nullnetwork.net/viewimage.php?id=4889
> > This look is also used for the top bar in the new GNOME system-settings.
> > 
> > I was wondering whether there is an easy way to turn a GtkButtonBox into
> > something with this look.
> 
> have you looked into the GtkFileChooserDialog source, such as
> http://git.gnome.org/browse/gtk+/tree/gtk/gtkfilechooserwidget.c ?
> 
> Olivier
> 
> 
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Re: Howto make a Gtk.Buttonbox look like the path bar in Gtk.FileChooserDoalog?

2012-09-03 Thread Moritz Renftle
thanks so much!
moritz

Am Montag, den 03.09.2012, 22:36 +0200 schrieb Paul Lange:
> Hey Moritz,
> 
> have a look at line 211 and 212. That should do the trick!
> 
> regards,
> Paul
> 



___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Howto set up a CSS-Animation for the "packing-process" of a container?

2012-09-18 Thread Moritz Renftle
Hi,

I read about GTK's fancy new opportunities concerning CSS-styling and
thought I had a use-case for it:

My app has a Gtk.Grid with other widgets packed into it. Is it possible
to create a CSS-file, which defines an animation for the packing- and
removing-process of the Gtk.Grid?

More generally: is it possible to "connect" animations to signals (e.g.
set up an animation for the "changed"-signal of Gtk.Entry)?

Thanks for any answers,
Moritz

PS: CSS-theming is really fun, keep up the good work!






___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: PATHBAR written using GTK 3

2012-10-02 Thread Moritz Renftle
Hi Mariano,

I asked a similar question some time ago, but I only wanted to achieve
the looks of the PathBar-Widget (as used in e.g. GtkFileChooser). If
this is what you need, have a look at the docs of GtkStyleContext, you
need to add GTK_STYLE_CLASS_LINKED to the context.

source of GtkPathBar:
http://fossies.org/dox/gtk+-3.4.4/gtkpathbar_8c_source.html
line 211 and 212 are responsible for the PathBar-like looks.

you find the thread here:
https://mail.gnome.org/archives/gtk-app-devel-list/2012-September/msg7.html

regards Moritz

Am Dienstag, den 02.10.2012, 03:42 -0300 schrieb Mariano Gaudix:
> Hello  .
> Excuse me   .  For  my   the question .. someone  have   or  seen a
> PATHBAR   written with gtk 3 .
> You  can  tell me   the page address where you can download the code for
> this widget  .
> I need to know how to make a PATHBAR with GTK3 .
> 
> 
> 
> Best regards
> 
> 
> Mariano
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list