Example #1
0
class Template:
    def __init__(self, window):
        self.window = window
        self.ruleset = window.ruleset
        self.generic_links = GenericLinksDialog(self.window, self.saveGenericLinks)
        self.connectSlots()
        self.dialog = TemplateDialog(window)

    def connectSlots(self):
        window = self.window
        ui = window.ui
        if ui.multisite_type != MULTISITE_SLAVE:
            window.connect(ui.action_manage_templates, SIGNAL("triggered()"), self.manageTemplates)
        window.connect(ui.action_generic_links, SIGNAL('triggered()'), self.editGenericLinks)

    def manageTemplates(self):
        self.dialog.exec_()

    def refresh(self, all_updates, updates):
        self.ruleset.readAttributes()

    def display(self, updates, highlight=False):
        pass

    def editGenericLinks(self):
        ui = self.window
        if ui.multisite_type == MULTISITE_MASTER and ui.eas_window is not None and 'ew4_multisite' in ui.eas_window.apps:
            multisite = ui.eas_window.apps['ew4_multisite']
            multisite.setupGenericLinks()
        else:
            links = self.ruleset('genericLinksGet')
            self.generic_links.modify(links)

    def saveGenericLinks(self):
        try:
            links = self.generic_links.getLinks()
            updates = self.ruleset('genericLinksSet', dict(links))
        except Exception, err:
            self.window.exception(err)
            return False
        self.window.refresh(updates)
        return True
Example #2
0
 def __init__(self, window):
     self.window = window
     self.ruleset = window.ruleset
     self.generic_links = GenericLinksDialog(self.window, self.saveGenericLinks)
     self.connectSlots()
     self.dialog = TemplateDialog(window)