Ejemplo n.º 1
0
    def __init__(self, parent):
        self.model = ZBackgroundTaskManagerModel()

        ZBaseWindow.__init__(
            self,
            parent,
            _extstr(u"bgtaskmanager.BackgroundTaskManager"),
            name=u"ZBackgroundTaskManager")  #$NON-NLS-2$ #$NON-NLS-1$
        ZPersistentDialogMixin.__init__(self, IZAppUserPrefsKeys.BGTASK_WINDOW)

        self.Layout()

        self.model.getService().addListener(self)
Ejemplo n.º 2
0
    def __init__(self, parent):
        self.model = ZBackgroundTaskManagerModel()

        ZBaseWindow.__init__(self, parent, _extstr(u"bgtaskmanager.BackgroundTaskManager"), name = u"ZBackgroundTaskManager") #$NON-NLS-2$ #$NON-NLS-1$
        ZPersistentDialogMixin.__init__(self, IZAppUserPrefsKeys.BGTASK_WINDOW)
        
        self.Layout()

        self.model.getService().addListener(self)
Ejemplo n.º 3
0
class ZBackgroundTaskManagerWindow(ZBaseWindow, IZBackgroundTaskServiceListener, ZPersistentDialogMixin):

    def __init__(self, parent):
        self.model = ZBackgroundTaskManagerModel()

        ZBaseWindow.__init__(self, parent, _extstr(u"bgtaskmanager.BackgroundTaskManager"), name = u"ZBackgroundTaskManager") #$NON-NLS-2$ #$NON-NLS-1$
        ZPersistentDialogMixin.__init__(self, IZAppUserPrefsKeys.BGTASK_WINDOW)
        
        self.Layout()

        self.model.getService().addListener(self)
    # end __init__()

    def _createWindowWidgets(self, parent):
        provider = ZBackgroundTaskListProvider(self.model)
        self.bgTaskList = ZBackgroundTaskPanelListBox(provider, parent)
        self.bgTaskList.SetSizeHints(400, 400)
        self.bgTaskList.SetBackgroundColor(wx.Color(235, 236, 244))
        self.cleanUpButton = wx.Button(parent, wx.ID_ANY, _extstr(u"bgtaskmanager.CleanUp")) #$NON-NLS-1$
    # end _createWindowWidgets()

    def _populateWindowWidgets(self):
        self.SetIcons(getResourceRegistry().getIconBundle(ICON_IMAGES))
    # end _populateWindowWidgets()

    def _layoutWindowWidgets(self):
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.bgTaskList, 1, wx.EXPAND | wx.ALL, 8)
        sizer.Add(self.cleanUpButton, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, 5)

        return sizer
    # end _layoutWindowWidgets()

    def _bindWidgetEvents(self):
        self.Bind(wx.EVT_CLOSE, self.onClose, self)
        self.Bind(wx.EVT_BUTTON, self.onCleanUp, self.cleanUpButton)
        self.Bind(ZEVT_REFRESH, self.onRefresh, self)
    # end _bindWidgetEvents()

    def onCleanUp(self, event):
        self.model.cleanUpTasks()
        event.Skip()
    # end onCleanUp()
    
    def onRefresh(self, event):
        self.bgTaskList.Refresh()
        event.Skip()
    # end onRefresh()

    def _setInitialFocus(self):
        pass
    # end _setInitialFocus()

    def onClose(self, event):
        self._destroyPanels()
        self.model.getService().removeListener(self)

        global BGTASK_MANAGER_WINDOW
        BGTASK_MANAGER_WINDOW = None

        event.Skip()
    # end onClose()

    def onTaskAdded(self, task): #@UnusedVariable
        fireRefreshEvent(self)
    # end onTaskAdded()

    def onTaskRemoved(self, task): #@UnusedVariable
        fireRefreshEvent(self)
    # end onTaskRemoved()

    def _destroyPanels(self):
        self.bgTaskList.destroyPanels()
Ejemplo n.º 4
0
class ZBackgroundTaskManagerWindow(ZBaseWindow,
                                   IZBackgroundTaskServiceListener,
                                   ZPersistentDialogMixin):
    def __init__(self, parent):
        self.model = ZBackgroundTaskManagerModel()

        ZBaseWindow.__init__(
            self,
            parent,
            _extstr(u"bgtaskmanager.BackgroundTaskManager"),
            name=u"ZBackgroundTaskManager")  #$NON-NLS-2$ #$NON-NLS-1$
        ZPersistentDialogMixin.__init__(self, IZAppUserPrefsKeys.BGTASK_WINDOW)

        self.Layout()

        self.model.getService().addListener(self)

    # end __init__()

    def _createWindowWidgets(self, parent):
        provider = ZBackgroundTaskListProvider(self.model)
        self.bgTaskList = ZBackgroundTaskPanelListBox(provider, parent)
        self.bgTaskList.SetSizeHints(400, 400)
        self.bgTaskList.SetBackgroundColor(wx.Color(235, 236, 244))
        self.cleanUpButton = wx.Button(
            parent, wx.ID_ANY, _extstr(u"bgtaskmanager.CleanUp"))  #$NON-NLS-1$

    # end _createWindowWidgets()

    def _populateWindowWidgets(self):
        self.SetIcons(getResourceRegistry().getIconBundle(ICON_IMAGES))

    # end _populateWindowWidgets()

    def _layoutWindowWidgets(self):
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.bgTaskList, 1, wx.EXPAND | wx.ALL, 8)
        sizer.Add(self.cleanUpButton, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM,
                  5)

        return sizer

    # end _layoutWindowWidgets()

    def _bindWidgetEvents(self):
        self.Bind(wx.EVT_CLOSE, self.onClose, self)
        self.Bind(wx.EVT_BUTTON, self.onCleanUp, self.cleanUpButton)
        self.Bind(ZEVT_REFRESH, self.onRefresh, self)

    # end _bindWidgetEvents()

    def onCleanUp(self, event):
        self.model.cleanUpTasks()
        event.Skip()

    # end onCleanUp()

    def onRefresh(self, event):
        self.bgTaskList.Refresh()
        event.Skip()

    # end onRefresh()

    def _setInitialFocus(self):
        pass

    # end _setInitialFocus()

    def onClose(self, event):
        self._destroyPanels()
        self.model.getService().removeListener(self)

        global BGTASK_MANAGER_WINDOW
        BGTASK_MANAGER_WINDOW = None

        event.Skip()

    # end onClose()

    def onTaskAdded(self, task):  #@UnusedVariable
        fireRefreshEvent(self)

    # end onTaskAdded()

    def onTaskRemoved(self, task):  #@UnusedVariable
        fireRefreshEvent(self)

    # end onTaskRemoved()

    def _destroyPanels(self):
        self.bgTaskList.destroyPanels()