[pygtk] text style on title (taskbar)

2010-03-03 Thread middleofdre...@gmail.com
Hi,
I'm wondering how to inform taskbar or wm that window needs user interaction
(for example bold text on taskbar). I was trying to do
window.set_urgency_hint(True) but this one does nothing.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] How to show widget and move window slightly?

2010-02-10 Thread middleofdre...@gmail.com
Hi,
I have an app which has some default hidden widget (some container). How
show it in the right side of app (rest of the window should stay in same
place) ?
I tried 2 things:
 - set window gravity to EAST and then show widget. Just didn't work in some
window managers (works for compiz, don't work for openbox for example)
 - show widget and then move window to left - it works always but looks ugly
(u can see that window is moving).
So... some better way to do this?
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] [SOLVED] Re: TreeView (liststore) sorting.

2010-02-04 Thread middleofdre...@gmail.com
I finally figure it out. For those who also is (or will) looking for
something like that:

 someliststore.set_sort_func(5,compare_data)
 someliststore.set_sort_column_id(5,gtk.SORT_DESCENDING)

def compare_data(model, iter1, iter2):
data1 = model.get_value(iter1,5)
data2 = model.get_value(iter2,5)
if data1==data2:
#if same vals:
data1 = model.get_value(iter2,0)
data2 = model.get_value(iter1,0)
#sort by other column in reverse order
data2=data2.lower()
data1=data1.lower()
#just for make it case insensitive
#no need adding it for column 5 - there are integers
return cmp(data1, data2)
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] TreeView (liststore) sorting.

2010-02-03 Thread middleofdre...@gmail.com



 http://www.pygtk.org/docs/pygtk/class-gtktreesortable.html#method-gtktreesortable--set-sort-func

 I strongly suggest using devhelp and taking a look at the page of the
 classes you happen to use: even by a fast glance, you can learn many
 things.


And I'm always doing it but this time... i have no idea how too use it. An
example would be great
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] TreeView (liststore) sorting.

2010-02-03 Thread middleofdre...@gmail.com
I have now something like that:
 view['listmodel'].set_sort_column_id(5,gtk.SORT_DESCENDING)
view['listmodel'].set_sort_func(5,compare_data, 5)
view['listmodel'].set_sort_func(0,compare_data, 0)

...

def compare_data(model, iter1, iter2, column):
   data1 = model.get_value(iter1,column)
   data2 = model.get_value(iter2,column)
   print data1, data2, cmp(data1, data2)
   return cmp(data1, data2)


but it sorts only by column 5. tried also
  view['listmodel'].set_sort_func(5,compare_data, 0)
but it doesn't work...
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] TreeView (liststore) sorting.

2010-02-02 Thread middleofdre...@gmail.com
I was looking for this in net but still i have no idea how to set priority
of sorting. For example i'm doing:
 somelistmodel.set_sort_column_id(0,gtk.SORT_ASCENDING) and it sort it
right. But when elements in column 0 are the same, a want to sort by column
1.
 How to?
I've tried
somelistmodel.set_sort_column_id(1,gtk.SORT_ASCENDING)
somelistmodel.set_sort_column_id(0,gtk.SORT_ASCENDING), but that doesn't
work.

I hope i'm clear enough
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] gtk.Window [ popup from TextView ]

2010-02-02 Thread middleofdre...@gmail.com
2010/1/31 M.B. spooky...@tbs-software.com

 hi all,
 please help me with little problem [ the big one for me right now :(]
 i write little app [ texteditor , who not :) ]

 from textview i call window popup with help. [pressing 'a' in test
 prog ] and i have 2 questions.

 1.) how i disable automatic Tab inserted after pasting text from popup ?
use another key is solution but i want Tab as completer.

 2.) it seems to same prob as in 1.) but how i disable moving cursor in
textbuffer when popup window is active and i changing rows in
treeview ? when i change type on WINDOW_TOPLEVEL my treeview has
focus and i cannot write into buffer.

 Ad1 - I don't know if is right solution but you have create simple function
on signal text-inserted-  if text is tab - buffer.backspace(). I'm doing
something like that with enter key.

Ad2. I'm not sure here either but you can set sensitive to 0 when popup
comes, and set to 1 when you close it.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Keyboard Events Issue

2010-02-02 Thread middleofdre...@gmail.com
2010/2/2 Andy B ab.ml...@ntlworld.com

 Hi,

 Not sure whether this is a pygtk or a gtk issue, but...

 I've written an app which relies on key-press and key-release events.
  Under windows XP, python 2.6, pygtk 2.16 and gtk+ 2.18 there are no
 problems, however under ubuntu 9.10 (32  64bit) I'm seeing a key-release
 event following each key-press event whilst a key is held down.


Maybe something with system configuration? IDK but on Arch:
key press= D
key press= D
key press= D
key press= D
key press= D
key press= D
key press= D
key release= D

When i'm holding 'D' down and then release.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] How to organize my app?

2010-01-22 Thread middleofdre...@gmail.com
I forgot something like MVC exists
Is it hard to learn for example pygtkmvc and rebuild existing app (which is
written in chaos mode - everything everywhere)? In which point of my app I
should start? I'll give you the code... as messy as it is.

http://github.com/middleofdreams/pybber

comments are in polish but it doesn't really matter.

2010/1/22 Tobias Weber t...@celvina.de

 On 21.01.2010, at 23:14, middleofdre...@gmail.com wrote:

 I think you're looking for the MVC pattern. You can read it up and do
 it on foot or use a framework like Kiwi.

  For example - I have main class in main file and I want to move
  widgets (loading widgets from gladefile) into new file.

 View

  Or signal handlers - how to move them into other file and do it right?

 Controller

  self.gui.some_widget.show()


 This is exactly how it'd look with
 http://sourceforge.net/apps/trac/pygtkmvc/wiki
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] Adjust gtk.ScrolledWindow

2010-01-21 Thread middleofdre...@gmail.com
Hi, In my App I was using gtk.TextWiev for displaying text. If some new text
appeard I could use textview.scroll_to_iter or something like this. Now I'm
using Webkit... And here is a problem. How to scroll down on new text? I
connected webkit signal load-finished with function:

pos=self.scrolled.get_vadjustment()
newpos=pos.get_upper()-pos.get_page_size()
pos.set_value(newpos)
self.scrolled.set_vadjustment(pos)

Sometimes it works perfectly, but sometimes... i see only half of last line.
Why's that? And how to make it work...

Btw, Is it possible to append text to rendered html in webkit (rendered from
string... if that matters)? Maybe in javascript (which i don't know at all)
or wekbit-wide?


Greetings,
Kuba

PS - sorry for my english - it's not my native language.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] How to organize my app?

2010-01-21 Thread middleofdre...@gmail.com
Hi,
I don't have experience in creating big apps. I want to know how to split
app into files. For example - I have main class in main file and I want to
move widgets (loading widgets from gladefile) into new file. It should be in
the mainclass i think.. but i can't import something inside class (it works
but it's not proper). Or signal handlers - how to move them into other file
and do it right? Another thing is i have some (not main) class, but it
should interact with gui (some changes like showing widgets etc). It's
assigned in mainclass and constructor of it looks like this:

__init__(gui):
self.gui=gui

and then.. in functions of this class I can change for example
self.gui.some_widget.show()
And again.. I don't think it's proper method for doing this.

Some tips, please?
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] How to organize my app?

2010-01-21 Thread middleofdre...@gmail.com
I see i was doing it wrong from the begining. gui was my main class but it
shouldn't.

2010/1/21 Pietro Battiston too...@email.it

Il giorno gio, 21/01/2010 alle 23.14 +0100, middleofdre...@gmail.com ha
 scritto:
  Hi,
  I don't have experience in creating big apps. I want to know how to
  split app into files. For example - I have main class in main file and
  I want to move widgets (loading widgets from gladefile) into new file.
  It should be in the mainclass i think.. but i can't import something
  inside class (it works but it's not proper).

 If you don't want it into the same file of the main class, you
 certainly don't want it into the main class is a rule for which I'm not
 able to see any exception.

 That said, what I do in many projects is creating this file:


 import gtk

 class Ui(object):
def __init__(self, APP, filename):
self._builder = gtk.Builder()
self._builder.set_translation_domain(APP)
self._builder.add_from_file(filename)

def __getattr__(self, attr_name):
try:
return object.__getattribute__(self, attr_name)
except AttributeError:
obj = self._builder.get_object(attr_name)
if obj:
self.obj = obj
return obj
else:
raise AttributeError, no object named \%s\ in the
 GUI. % attr_name



 and importing Ui from it; then, the main class will, in __init__, do
 something like

self.ui = Ui(nameoftheapp, path/to/the/file.glade)

 so that from now on you just access widgets as

self.ui.name_of_the_widget


Interesting... but.. if I use this method where I should do
signals_autoconnect?


  Or signal handlers - how to move them into other file and do it right?

 I'm not really sure I would want to move signal handlers... if all your
 handlers are method of this main class and you want to save some coding,
 just use signals_autoconnect.


I meant... functions for signals. They was in main class. for example:

dic={blabla: self.blabla}

and then
def blabla(self):
  self.label.set_text(blabla)

Can I create class for handling signals only?  If so - how?



  Another thing is i have some (not main) class, but it should interact
  with gui (some changes like showing widgets etc). It's assigned in
  mainclass and constructor of it looks like this:
 
 
  __init__(gui):
  self.gui=gui
 
 
  and then.. in functions of this class I can change for example
  self.gui.some_widget.show()
  And again.. I don't think it's proper method for doing this.
 

 Well, in my opinion it's hard to say _in general_ that this is wrong.
 When you choose the optimal size for some class, just think in terms of
 functionalities: the best rule to respect is that it must be
 comfortable.

 Certainly, if self.gui.some_widget.show() is part of a block of code
 that works on the gui, it may be smart to move it to a method of the gui
 and call that from your class.


But sometimes I have to change something in gui when some class signal is
emited (in new thread). I just don't know how to do it most cleanly and
lightweight way.



 
  Some tips, please?
 

 Read other people's code, and just try. And obviously, be ready to
 change things that you find not optimal.


Maybe some example app you can recommend? I was looking for something but
found only apps with bilion of lines of code... i'm not smart enough to get
through it.


 Pietro


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/