RE: [pygtk] Using GnomeCanvasBpath on a gnome.canvas?

2006-07-28 Thread Hussein Vastani
try this
item = self.acanvas.root().add(gnomecanvas.CanvasBpath,
   outline_color='yellow',
   width_pixels=2)


>= Original Message From Tobias Bengtsson <[EMAIL PROTECTED]> =
>Hi
>
>I read the following and tried it out in attached code.. but it doesn't
>work, atleast not here. What could be wrong? anyone? gjc?
>
>google://gnomecanvasbpath python curveto
>http://www.daa.com.au/pipermail/pygtk/2004-July/008140.html
>http://bugzilla.gnome.org/show_bug.cgi?id=136617
>http://www.math.ias.edu/doc/gnome-python2-2.6.0/ChangeLog
>
>regards, Tobias
>
>
>___
>pygtk mailing list   pygtk@daa.com.au
>http://www.daa.com.au/mailman/listinfo/pygtk
>Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


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


[pygtk] question abt editable text in treeview

2006-06-12 Thread Hussein Vastani
Hello All, 
I have a treeview with all editable columns in my app.
It gets very frustrating when, for example, I have a row selected and I click 
on every cell in that row and the editing starts for that cell. What I want is 
that when I click on a cell, I dont want it to go into the editing mode, if 
another cell is already in the editing mode. I just want this other cell to 
come out of the editing mode (as if I had clicked on a different row). Then I 
should have to click on the new cell again to begin editing. Ofcourse if there 
is no cell in editable mode, then clicking on anycell should immediately put 
it in editable mode.
Any suggestions?

Hussein Vastani


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


[pygtk] Need help with Tree/List view

2006-06-09 Thread Hussein Vastani
Hello All,

I am currenly using the gtk TreeView to display text (simple and markedup), 
pixbufs, dropdown list and editable text in my application.
Not all the columns are editable. Lets say the 1st, 4th and 7th columns are 
editable and others (besides the dropdownlist) are not. 
Now my question is. How do I indicate to the user which cell in the row is 
editable. If he/she has selected a particular row, then there is no clear 
indication that the particular cell he/she has clicked on or has navigated to, 
can be edited. Is there a way to select/highlight one cell at a time ( like in 
a spreadsheet )?? By default it draws a box around the text of the editable 
cell  (due to the editable mode) while moving from cell to cell, but this box 
is not visible because the row higlight color is dark enough to hide it. 
Any suggestions ???

Hussein Vastani


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


[pygtk] app freeze problem

2006-03-31 Thread Hussein Vastani
Hello All, 
In my program I have gobject.io_add_watch waiting on a receive socket and a 
callback passed to it as parameter which gets called when ever some data 
arrives on that socket. 
Now the problem is that the data is arriving at a very fast rate. say 60 to 
100 times a second. My callback gets called successfully and in my callback I 
parse this data and display it on a treeview ( using store.set_value() method 
).
My callback is not long and computational but my treeview does not display the 
data and my application becomes unresponsive. 
Any suggestions on handling this scenario? I tried handle_pending_events but 
that did not help much ( i guess coz i have soo many io events pending )

Any help is appreciated
Thanks

Hussein Vastani


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


[pygtk] Zooming Text on Canvas

2006-03-16 Thread Hussein Vastani
Hello All, 
I cant figure out a way to Zoom text on a canvas
I have CanvasItems like CanvasLine, CanavsPixbuf and CanvasText on my canvas 
and with the canvas.set_pixels_per_unit(..) method, all but CanvasText zoom 
ok. 
Is there is any reason why my CanvasText does not zoom ?
BTW my Canvas is not in antialiased mode and this is how I add my text to the 
canvas.

text = self.root().add(gnomecanvas.CanvasText,
   fill_color='black')text.set_property('anchor', 
gtk.ANCHOR_WEST)
text.set_property('size-points', 15.0)
text.move(x_loc,y_loc)
text.set_property('text', "MYTEXT")

Any help will be appreciated
Thanks

Hussein Vastani


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


[pygtk] Question abt sudo and password

2006-03-15 Thread Hussein Vastani
Hello All,

In my application, I run external programs by running a shell using 
subprocess.Popen and then writing commands to it (like 'ls -la') and reading 
output from it which I then display it on the screen.
It works fine as long as the external program does not need to run as sudo 
(like tethereal), in which case, I need to provide the password to it (on the 
konsole).

I tried looking at the gksu module. Using the gksu module I can instantiate 
its Context class and then call the sudo_run() method after setting the 
command and the password in the Context instance. That works fine but is not 
the approach I want to take since I want to run commands and read their ouput 
back.

So sticking to my use of Popen to execute commands, and assuming I have a way 
to get the sudo password from the user via a Dialog box, how do I then exectue 
my command without it asking me a password on the konsole?

I would  not like to modify the /etc/sudoers file. Is there any other 
approach?

Any help is appreciated
Thanks

Hussein Vastani


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


[pygtk] CellRendererCombo Question

2006-03-08 Thread Hussein Vastani
Hello All, 
Does anyone know if something like the wrap_width function is implemented for 
the CellRendererCombo in pygtk? 
Heres the scenario. 
I populate my combobox (in my treeview) dynamically and want to display it in 
more than one column if the list is large.

This is how I set it up :

model = gtk.Liststore(str)
tree_store_col = 0
cell_renderer = gtk.CellRendererCombo()
cell_renderer.set_property("model",model)
cell_renderer.set_property('text-column', 0)
cell_renderer.set_property('editable', True)
new_col = gtk.TreeViewColumn(col_name, cell_renderer, text=tree_store_col)
tree.append_column(new_col)
cell_renderer.connect('editing-started', populate_combo, (tree_store,))

And this is how I populate the combobox in the populate_combo callback
def populate_combo(self, cell, editable, path, data):
store = data[0]
iter = store.get_iter(path)
items = self.get_list() # my function get_list() returns a list of strings
m = cell.get_property('model')
m.clear()
items.sort()
for s in items:
m.append([s])

so if my items list is large, it gets frustrating to scroll the entire list to 
get to the required item. It would be nice if the items were displayed in more 
than one column (for eg.)
Any suggestions on how to make this better?

Thanks

Hussein Vastani




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


[pygtk] Question about row selection in treeview/listview

2005-10-17 Thread Hussein Vastani
Hello all, 
I have a treeview in my application and I'm trying to figure out how to 
'select' individual cells in the treeview. By 'select', I mean either
a) That particular cell gets highlighted, or
b) The entire row gets highlighted but the particular cell that I am 
interested in has a different background color ( other than the blue ), or a 
thick border
Other option (since Im not clear abt how to implement any of the above), that 
I tried is setting the mode of the cellrenderer to 
gtk.CELL_RENDERER_MODE_ACTIVATABLE, but i can see that the cell gets activated 
ONLY when i use my keyboard and not when I click the cell with my mouse.
Bottom line is that I am trying some way to show the user that he/she has 
selected a particular cell in the tree view.

Im sure someone mustve implemented the above or some variant of it to achieve 
the same purpose. Can you give me some ideas on its implementation in pygtk

Any help is appreciated

Vastani


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


RE: [pygtk] question about handle pending events

2005-07-19 Thread Hussein Vastani
Thank you for your reply Philip
The cancel flag is what I really want to avoid because my initialization 
callback calls many functions within itself that return True/False for their 
own purpose and which may or maynot call main_iteration(). So this will 
require that I put the cancel check at several places (inside the called 
function and the caller function ) which is gonna make the code look very 
ugly. :(

_h

>= Original Message From Phillip Calvin <[EMAIL PROTECTED]> =
>Hussein Vastani wrote:
>
>>Hello,
>>Ok so i read that if I have
>>
>>while gtk.events_pending():
>>gtk.main_iteration(False)
>>
>>inserted at the right places in my callback (which can be long computational
>>), my application would look response since it will get an opportunity to
>>handle other user events while completing the callback. Consider a case 
where
>>the user clicks on a button which opens up another window and does some
>>initialization like populating three different huge tree stores and updating
>>displays. I call main interation within this initialization code and
>>everything looks good. But what if the user tries to close the window while
>>the initialization callback is being executed. It will handle the destroy
>>event and when it comes back to finish the initialization callback, the 
window
>>does not exist anymore and things start crashing. I really want to keep my
>>applicaition single threaded. Has anyone come across such a problem ? How do 
i
>>
>>
>I usually fix this sort of problem by setting a global "cancelled"
>variable and checking for that in the computational loop.  Obviously you
>have to reset it when you're done, though, which is a pain.
>
>>stop the callback from finishing its execution when the destroy event is
>>handled. Or. How do I peep into the event stack to see if there is any
>>destroy-event pending to be handled ( so i dont call the main_iteration that
>>time ). These are some ideas but they look hackish for me.
>>Any help is appreciated.
>>
>>_h
>>
>>___
>>pygtk mailing list   pygtk@daa.com.au
>>http://www.daa.com.au/mailman/listinfo/pygtk
>>Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>>
>>
>>
>>

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


[pygtk] question about handle pending events

2005-07-19 Thread Hussein Vastani
Hello,
Ok so i read that if I have

while gtk.events_pending():
gtk.main_iteration(False)

inserted at the right places in my callback (which can be long computational 
), my application would look response since it will get an opportunity to 
handle other user events while completing the callback. Consider a case where 
the user clicks on a button which opens up another window and does some 
initialization like populating three different huge tree stores and updating 
displays. I call main interation within this initialization code and 
everything looks good. But what if the user tries to close the window while 
the initialization callback is being executed. It will handle the destroy 
event and when it comes back to finish the initialization callback, the window 
does not exist anymore and things start crashing. I really want to keep my 
applicaition single threaded. Has anyone come across such a problem ? How do i 
stop the callback from finishing its execution when the destroy event is 
handled. Or. How do I peep into the event stack to see if there is any 
destroy-event pending to be handled ( so i dont call the main_iteration that 
time ). These are some ideas but they look hackish for me. 
Any help is appreciated.

_h

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


[pygtk] open window at specific location on screen

2005-06-16 Thread Hussein Vastani
Hi all. 
Does anyone know of a way to open a window at a specific location on the 
screen?. For example I have created a window using glade and I always want 
that window to open up on the top left corner of my screen. Currently it opens 
up at random places on the screen. Is this possible in pygtk? or will I have 
to mess around with X ? ( id like to not do that )

Thanks for any help

-h

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


[pygtk] Change color of tree view column header

2005-06-14 Thread Hussein Vastani
Hello All, 
Quick question, how do I change the background color of a TreeView Column 
header? I have few columns in my tree view and i want to change the background 
color (not the title color), of the even numbered column headers.
The TreeView column class does not seem to have any attribute to do that? Is 
it possible to do it?
Any help is appreciated

Thanks

-h

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


RE: [pygtk] right click menu

2005-04-22 Thread Hussein Vastani
Okay so thats what my problem is. I was handling the button-press-event and 
not the clicked. I should move my code to the 'clicked'
Thank you

>= Original Message From James Pelletier <[EMAIL PROTECTED]> =
>Here's what I did (the view button-press-event is connected to 'clicked'):
>
>def clicked(self, view, event):
>   if event.button == 3:
> path, col, cellx, celly = view.get_path_at_pos(int(event.x),
>   int(event.y))
> # just in case the view doesn't alreay have focus
> view.grab_focus()
> selection = view.get_selection()
> # if this row isn't already selected, then select it before popup
> if not selection.path_is_selected(path):
>   view.set_cursor( path, col, 0)
> contextMenu.popup( None, None, None, event.button, event.time)
> return True
>
>
>Chris Lambacher wrote:
>> sel = treeview.get_selection()
>> if sel.count_selected_rows == 1:
>> sel.unselect_all()
>> sel.select_path(path)
>>
>> On 4/22/05, Chris Lambacher <[EMAIL PROTECTED]> wrote:
>>
>>>Sounds like you are trying to solve two problems here.
>>>
>>>If only one item is selected you want to unselect that item and select
>>>the new one.  If multiple are selected you want to just pop up the
>>>menu?
>>>
>>>What exactly are your use cases?  For whatever you are trying to do,
>>>you probably still want to use the selection object in order to get
>>>the information you need or set the selection you want:
>>>http://www.pygtk.org/pygtk2reference/class-gtktreeselection.html
>>>
>>>-Chris
>>>
>>>On 4/20/05, Hussein Vastani <[EMAIL PROTECTED]> wrote:
>>>
>>>Yes. but if for example, i have a single item selected in the list and then 
I
>>>right click on a different item. I'd like the first item that was selected 
to
>>>get unselected and the new item thats clicked to be selected. If i use
>>>select_path then the old selected item wont get unselected. Thats the 
reason I
>>>was using the set_cursor.
>>>
>>>Going back to my original problem, I tried using
>>>stop_emission('button-press-event') in my button press event handler of my
>>>treeview and it seems to work. I thought if i just did a 'return True' at 
the
>>>end of my button press event handler, that would not continue calling the
>>>other event handlers but that didnt work :( I dont know if this is the 
right
>>>way of doing it. Seems to me like a hack.
>>>
>>>-h
>>>
>>>
>>>>= Original Message From [EMAIL PROTECTED] =
>>>>Don't use set_cursor to select the row.  use something like:
>>>>   sel = treeview.get_selection()
>>>>   sel.select_path(path)
>>>>
>>>>set_cursor will override the current selection with what you give it
>>>>as an argument.
>>>>
>>>>-Chris
>>>>
>>>>
>>>>On 4/18/05, Hussein Vastani <[EMAIL PROTECTED]> wrote:
>>>>
>>>>>I dont know if this has been addressed before but how do I popup a box 
when
>>>
>>>I
>>>
>>>>>have selected multiple rows in a treeview.
>>>>>I have an button_press_event handler where I first check to see if the
>>>
>>>right
>>>
>>>>>click button was pressed and the row where it was pressed ( using
>>>>>get_path_at_pos ). I then select the row (using set_cursor) if its not
>>>
>>>already
>>>
>>>>>selected and then popup the menu box. But as soon as I right click on the
>>>
>>>row
>>>
>>>>>all my other rows get unselected. How do I avoid that and only popup the
>>>
>>>box
>>>
>>>>>on a right click?
>>>>>Thanks for any help
>>>>>
>>>>>-h
>>>>>
>>>>>___
>>>>>pygtk mailing list   pygtk@daa.com.au
>>>>>http://www.daa.com.au/mailman/listinfo/pygtk
>>>>>Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>>>>>
>>>>
>>>>
>>>>--
>>>>Christopher Lambacher
>>>>[EMAIL PROTECTED]
>>>
>>>
>>>--
>>>Christopher Lambacher
>>>[EMAIL PROTECTED]
>>>
>>
>>
>>

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


RE: [pygtk] Control + Click in Tree view

2005-04-20 Thread Hussein Vastani
hooking it to button_press_event worked for me. Thanks :)

-h


>= Original Message From Christian Robottom Reis <[EMAIL PROTECTED]> =
>On Fri, Apr 15, 2005 at 02:34:15PM -0400, Hussein Vastani wrote:
>> How do I know if a Cntrl + Click was pressed in a treeview?
>
>Look at
>
>http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq05.005.htp
>
>I _believe_ it's just a matter of hooking to button_press_event (instead
>of key_press_event) -- the control mask should be set on the event,
>regardless.
>
>I think there is another option you can use by inspecting the gdk window
>and then checking to see if control is pressed -- Gustavo, do you
>remember how this is done?
>
>Take care,
>--
>Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331

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


[pygtk] right click menu

2005-04-18 Thread Hussein Vastani
I dont know if this has been addressed before but how do I popup a box when I 
have selected multiple rows in a treeview. 
I have an button_press_event handler where I first check to see if the right 
click button was pressed and the row where it was pressed ( using 
get_path_at_pos ). I then select the row (using set_cursor) if its not already 
selected and then popup the menu box. But as soon as I right click on the row 
all my other rows get unselected. How do I avoid that and only popup the box 
on a right click? 
Thanks for any help

-h

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


[pygtk] Control + Click in Tree view

2005-04-15 Thread Hussein Vastani
How do I know if a Cntrl + Click was pressed in a treeview?
This is what I have now:
I have connected my treeselection object's 'changed' signal to some event 
handler 'x' and in 'x' I can figure out the currently selected rows with the 
function get_selected_rows(). So every time a user selects a single or 
multiple rows, my handler 'x' is called and i know the selected rows. But what 
I also want to know if the control button was pressed when the click(select) 
was made. I cannot use the key_press_event signal handling because that does 
not guarentee that a click was also made when any key was pressed. 
Thanks for your help in advance.

-h

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


RE: [pygtk] Cell editing in pygtk

2005-02-03 Thread Hussein Vastani
cellrenderer does not have any signal called 'changed' so i cannot use that. 
any other ideas?


>= Original Message From Steve McClure <[EMAIL PROTECTED]> =
>On Thu, 2005-02-03 at 15:28 -0500, Hussein Vastani wrote:
>> Is there a signal that is emitted when you start editing a cell? I have a
>> liststore with three columns. The first column is not editable, the second 
and
>> third one are. I want to know when exactly a user starts editing and what
>> column is he/she editing. I know about the 'edited' signal but that is 
emitted
>> only after editing is complete. I want to know if editing has started or if 
it
>> has not finished yet.
>> Thank you
>>
>> vastani
>
>'changed' ?
>
>>
>> ___
>> pygtk mailing list   pygtk@daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>--
>Steve McClure   Racemi
>email: [EMAIL PROTECTED]  75 5th St NE
>voice: 404-892-5850 Suite 333
>fax: 404-892-7215   Atlanta, GA 30308
>http://www.racemi.com

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


[pygtk] Cell editing in pygtk

2005-02-03 Thread Hussein Vastani
Is there a signal that is emitted when you start editing a cell? I have a 
liststore with three columns. The first column is not editable, the second and 
third one are. I want to know when exactly a user starts editing and what 
column is he/she editing. I know about the 'edited' signal but that is emitted 
only after editing is complete. I want to know if editing has started or if it 
has not finished yet. 
Thank you

vastani

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