def __init__(self, parent, config): ''' Input: parent : tkinter parent widget config : applicationConfig object (the webGobbler configuration) ''' self._parent = parent self.imageLabel = None # The widget which displays the image. self.config = config # The main webGobbler configuration self.assembler = webgobbler.assembler_superpose( pool=webgobbler.imagePool(config=config), config=config) # The assembler (which creates images) self.assembler.start( ) # Start the assembler. (The assembler and collectors will work in background.) self._parent.protocol( "WM_DELETE_WINDOW", self.handlerExit ) # Catch the "close window" event sent by the window manager. self.lastImageDate = None # Date when last image was generated. self.lastImage = None # Last generated image (PIL Image object.) self.closing = False # If True, the application is currently closing (probably waiting for network connections to close.) self.currentlyAssembling = False # Is the assemble currently assembling ? self._widgets = {} # List of stateful widgets self._initializeGUI() # Create the GUI self.setStatus("webGobbler running.") self.timerCollectorsStatus = self._parent.after( 250, self._updateCollectorStatus) self._updateImage() # Regularly update the image from the assembler. self.handlerGenerateNow() # Generate a new image right now.
def handlerStartNewImage(self): dialog = Pmw.MessageDialog(self._parent, title = 'Confirmation', message_text = 'Do you really want to discard current image and start a new one ?', buttons = ('Yes,\nstart new image', 'NO,\nkeep current image'), defaultbutton = 'NO,\keep current image') result = dialog.activate() dialog.withdraw() if result == 'Yes,\nstart new image': self.assembler.shutdown() # Stop current assembler. #self.assembler.join() # Start a new assembler with this new configuration: self.assembler = webgobbler.assembler_superpose(pool=webgobbler.imagePool(config=self.config),config=self.config,ignorePreviousImage=True) self.assembler.start() self.handlerGenerateNow() # Generate a new image right now.
def handlerConfigure(self): import webgobbler_config # FIXME: grey out menues so that user does not call the config Windows several times at once. wgconfig = webgobbler_config.wg_confGUI(None) # Display webGobbler configuration screen. # webGobbler configuration windows will read configuration from registry or .ini file. wgconfig.focus_set() self._parent.wait_window(wgconfig.top) # Wait for window to close. if wgconfig.configChanged: # Configuration was changed. self.config = wgconfig.config # Get the new configuration # Kill the old assembler: self.assembler.shutdown() #self.assembler.join() # Set the new proxy address (if any) self.config = webgobbler.setUrllibProxy(log=None,CONFIG=self.config) # Start a new assembler with this new configuration: self.assembler = webgobbler.assembler_superpose(pool=webgobbler.imagePool(config=self.config),config=self.config) self.assembler.start()
def handlerStartNewImage(self): dialog = Pmw.MessageDialog( self._parent, title='Confirmation', message_text= 'Do you really want to discard current image and start a new one ?', buttons=('Yes,\nstart new image', 'NO,\nkeep current image'), defaultbutton='NO,\keep current image') result = dialog.activate() dialog.withdraw() if result == 'Yes,\nstart new image': self.assembler.shutdown() # Stop current assembler. #self.assembler.join() # Start a new assembler with this new configuration: self.assembler = webgobbler.assembler_superpose( pool=webgobbler.imagePool(config=self.config), config=self.config, ignorePreviousImage=True) self.assembler.start() self.handlerGenerateNow() # Generate a new image right now.
def __init__(self,parent,config): ''' Input: parent : tkinter parent widget config : applicationConfig object (the webGobbler configuration) ''' self._parent = parent self.imageLabel = None # The widget which displays the image. self.config = config # The main webGobbler configuration self.assembler = webgobbler.assembler_superpose(pool=webgobbler.imagePool(config=config),config=config) # The assembler (which creates images) self.assembler.start() # Start the assembler. (The assembler and collectors will work in background.) self._parent.protocol("WM_DELETE_WINDOW", self.handlerExit) # Catch the "close window" event sent by the window manager. self.lastImageDate = None # Date when last image was generated. self.lastImage = None # Last generated image (PIL Image object.) self.closing = False # If True, the application is currently closing (probably waiting for network connections to close.) self.currentlyAssembling = False # Is the assemble currently assembling ? self._widgets= {} # List of stateful widgets self._initializeGUI() # Create the GUI self.setStatus("webGobbler running.") self.timerCollectorsStatus = self._parent.after(250, self._updateCollectorStatus) self._updateImage() # Regularly update the image from the assembler. self.handlerGenerateNow() # Generate a new image right now.
def handlerConfigure(self): import webgobbler_config # FIXME: grey out menues so that user does not call the config Windows several times at once. wgconfig = webgobbler_config.wg_confGUI( None) # Display webGobbler configuration screen. # webGobbler configuration windows will read configuration from registry or .ini file. wgconfig.focus_set() self._parent.wait_window(wgconfig.top) # Wait for window to close. if wgconfig.configChanged: # Configuration was changed. self.config = wgconfig.config # Get the new configuration # Kill the old assembler: self.assembler.shutdown() #self.assembler.join() # Set the new proxy address (if any) self.config = webgobbler.setUrllibProxy(log=None, CONFIG=self.config) # Start a new assembler with this new configuration: self.assembler = webgobbler.assembler_superpose( pool=webgobbler.imagePool(config=self.config), config=self.config) self.assembler.start()