Update of /cvsroot/freevo/freevo/src/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv26485
Modified Files:
commands.py
Log Message:
cleanup, only show dialog when needed, image support
Index: commands.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/commands.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** commands.py 27 Oct 2003 20:15:58 -0000 1.8
--- commands.py 3 Nov 2003 18:04:43 -0000 1.9
***************
*** 15,18 ****
--- 15,21 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.9 2003/11/03 18:04:43 dischi
+ # cleanup, only show dialog when needed, image support
+ #
# Revision 1.8 2003/10/27 20:15:58 mikeruelle
# make use of outicon
***************
*** 66,69 ****
--- 69,73 ----
import os, popen2, fcntl, select, time
import pygame
+ import osd
#freevo modules
***************
*** 83,86 ****
--- 87,100 ----
menuwidget = menu.get_singleton()
+
+ def islog(name):
+ f = open(os.path.join(config.LOGDIR,'command_std%s.log' % name))
+ data = f.readline()
+ if name == 'out':
+ data = f.readline()
+ f.close()
+ return data
+
+
class LogScroll(PopupBox):
"""
***************
*** 176,183 ****
self.add_child(self.results)
self.results.add_item(text=_('OK'), value='ok')
! self.results.add_item(text=_('Show Stderr'), value='err')
! self.results.add_item(text=_('Show Stdout'), value='out')
self.results.toggle_selected_index(0)
def eventhandler(self, event, menuw=None):
--- 190,201 ----
self.add_child(self.results)
self.results.add_item(text=_('OK'), value='ok')
! if islog('err'):
! self.results.add_item(text=_('Show Stderr'), value='err')
! if islog('out'):
! self.results.add_item(text=_('Show Stdout'), value='out')
self.results.toggle_selected_index(0)
+
+
def eventhandler(self, event, menuw=None):
***************
*** 208,212 ****
# and for displaying stdout and stderr of last command run.
class CommandItem(Item):
!
def makeNonBlocking(self, fd):
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
--- 226,235 ----
# and for displaying stdout and stderr of last command run.
class CommandItem(Item):
! def __init__(self, command, directory):
! Item.__init__(self)
! self.name = command
! self.cmd = os.path.join(directory, command)
! self.image = util.getimage(self.cmd)
!
def makeNonBlocking(self, fd):
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
***************
*** 215,218 ****
--- 238,242 ----
def getCommandOutput(self, command, outputfile, erroutputfile):
+ osd.get_singleton().show_mouse = True
child = popen2.Popen3(command, 1) # capture stdout and stderr from command
child.tochild.close() # don't need to talk to child
***************
*** 234,239 ****
if errchunk == '': erreof = 1
erroutputfile.write(errchunk)
! if outeof and erreof: break
select.select([],[],[],.1) # give a little time for buffers to fill
err = child.wait()
if (os.WIFEXITED(err)):
--- 258,265 ----
if errchunk == '': erreof = 1
erroutputfile.write(errchunk)
! if outeof and erreof:
! break
select.select([],[],[],.1) # give a little time for buffers to fill
+
err = child.wait()
if (os.WIFEXITED(err)):
***************
*** 261,271 ****
pop = PopupBox(text=popup_string)
pop.show()
! #print self.cmd
! myout = open(os.path.join(config.LOGDIR,'command_stdout.log'), 'wb')
! myerr = open(os.path.join(config.LOGDIR,'command_stderr.log'), 'wb')
status = self.getCommandOutput(self.cmd, myout, myerr)
myout.close()
myerr.close()
! #print status
icon=""
message=""
--- 287,305 ----
pop = PopupBox(text=popup_string)
pop.show()
!
! logfile = os.path.join(config.LOGDIR,'command_stdout.log')
! if os.path.isfile(logfile):
! os.unlink(logfile)
! myout = open(logfile, 'wb')
!
! logfile = os.path.join(config.LOGDIR,'command_stderr.log')
! if os.path.isfile(logfile):
! os.unlink(logfile)
! myerr = open(logfile, 'wb')
!
status = self.getCommandOutput(self.cmd, myout, myerr)
myout.close()
myerr.close()
!
icon=""
message=""
***************
*** 277,281 ****
message=_('Command Completed')
pop.destroy()
! CommandOptions(text=message).show()
--- 311,316 ----
message=_('Command Completed')
pop.destroy()
! if status or islog('err') or islog('out'):
! CommandOptions(text=message).show()
***************
*** 295,305 ****
commands.sort(lambda l, o: cmp(l.upper(), o.upper()))
for command in commands:
! cmd_item = CommandItem()
! cmd_item.name = command
! cmd_item.cmd = os.path.join(config.COMMANDS_DIR, command)
command_items += [ cmd_item ]
if (len(command_items) == 0):
! command_items += [menu.MenuItem(_('No Commands found'),
menuwidget.goto_prev_page, 0)]
! command_menu = menu.Menu(_('Commands'), command_items,
reload_func=menuwidget.goto_main_menu)
rc.app(None)
menuwidget.pushmenu(command_menu)
--- 330,342 ----
commands.sort(lambda l, o: cmp(l.upper(), o.upper()))
for command in commands:
! if os.path.splitext(command)[1] in ('.jpg', '.png'):
! continue
! cmd_item = CommandItem(command, config.COMMANDS_DIR)
command_items += [ cmd_item ]
if (len(command_items) == 0):
! command_items += [menu.MenuItem(_('No Commands found'),
! menuwidget.goto_prev_page, 0)]
! command_menu = menu.Menu(_('Commands'), command_items,
! reload_func=menuwidget.goto_main_menu)
rc.app(None)
menuwidget.pushmenu(command_menu)
***************
*** 333,337 ****
item.image = menu_items['commands'].image
if menu_items.has_key('commands') and menu_items['commands'].outicon:
! item.outicon = os.path.join(skin.settings.icon_dir,
menu_items['commands'].outicon)
item.parent = parent
return [ item ]
--- 370,375 ----
item.image = menu_items['commands'].image
if menu_items.has_key('commands') and menu_items['commands'].outicon:
! item.outicon = os.path.join(skin.settings.icon_dir,
! menu_items['commands'].outicon)
item.parent = parent
return [ item ]
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog