! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Support for xfce-exec in PyXfce
Status:
VERIFIED: FIXED
Severity:
enhancement

Comments

Description Stefan Stuhr 2006-01-05 19:51:42 CET
I am missing libxfcegui4's xfce-exec functions [1] in PyXfce.

For now I use xfce4.gui.gdk_spawn_command_line_on_screen, but it lacks the
terminal and startup notification support of xfce-exec.

Reproducible: Always
Steps to Reproduce:




[1]:
http://www.xfce.org/documentation/api-4.2/libxfcegui4/libxfcegui4-xfce-exec.html
and xfce_exec_on_screen.
Comment 1 dannym editbugs 2006-01-06 17:52:21 CET
"exec" is a reserved word in python. 
"exec" gives the wrong idea of what the function is doing (it does _not_ replace 
the caller's process by the called process like exec(3)).
There are way too many xfce_exec variants.
Startup notification stuff should be in gtk  (gtk_spawn...) instead.

That said, if you or I can come up with a nice single function for python with a 
nice non-stupid name that does the same stuff for now (until gtk includes it), 
I'm all for it :)

Comment 2 dannym editbugs 2006-01-06 17:54:50 CET
_and_ the timeout stuff of startup notification is a bad idea to begin with.
Comment 3 Stefan Stuhr 2006-01-06 18:04:32 CET
(In reply to comment #1)
> That said, if you or I can come up with a nice single function for python with a 
> nice non-stupid name that does the same stuff for now (until gtk includes it), 
> I'm all for it :)

What about something like:
def execute(command, in_terminal=False, use_sn=False, env=None, screen=None)

Maybe with another name, but it's a single function.
Comment 4 dannym editbugs 2006-01-06 21:41:05 CET
I think we need to add some stuff to xfce to make that work nicely without 
giving me nightmares. Actually I'm doing that right now :)
Comment 5 dannym editbugs 2006-01-06 23:11:18 CET
#!/usr/bin/env python

import xfce4
import gtk
import os

screen = gtk.gdk.screen_get_default()
id = xfce4.gui.startup_notification_start(screen, "/usr/bin/devhelp")

print id

new_environment = os.environ.copy()
new_environment[xfce4.gui.STARTUP_NOTIFICATION_ID_KEY] = id

# spawn using the usual python functions with an environment key added:

if os.spawnve(os.P_NOWAIT, "/usr/bin/devhelp", ("/usr/bin/devhelp", ), 
new_environment) < 0:
  print "FAILED"
  xfce4.gui.startup_notification_cancel(id)

gtk.main()

Comment 6 dannym editbugs 2006-01-06 23:23:40 CET
import xfce4

xfce4.gui.spawn_command_line("devhelp")

or

xfce4.gui.spawn_args(("/usr/bin/devhelp", ))


def spawn_command_line(command_line, in_terminal = False, 
use_startup_notification = True, screen = None, environment = None)

def spawn_args(args, in_terminal = False, use_startup_notification = True, 
screen = None, environment = None)

(see gui.py)
Comment 7 dannym editbugs 2006-01-06 23:26:48 CET
should be "fixed" now :)
Comment 8 Stefan Stuhr 2006-01-07 11:52:15 CET
(In reply to comment #7)
> should be "fixed" now :)

It works, thanks :)

Bug #1307

Reported by:
Stefan Stuhr
Reported on: 2006-01-05
Last modified on: 2006-01-07

People

CC List:
0 users

Version

Version:
unspecified

Attachments

Additional information