Exemplo n.º 1
0
    def btnRename_clicked_cb(self, widget):
        if self.selindex < 0:
            dlg.msgbox(
                "You must select an alias to rename.", gtk.MESSAGE_ERROR)
            return False

        sname = amutil.input_text(message="Enter a new name for this command:",
                                  default=self.selname)

        # No text, Item already exists, bad name?
        if self.item_badname(sname):
            return False

        # Retrieve old command, alter its name.
        self.lst_data[self.selindex].name = sname
        sexported = self.selitem.exported

        # Reload aliases from lst_data
        self.load_aliases(False)

        self.stat_settext("Item renamed: " + sname)
        self.printlog("Item renamed: " + sname)
        # Select new item
        self.alias_select_byname(sname)

        # Autosave preserves exported status
        if self.chkAutosave.get_active():
            if self.selitem.exported != sexported:
                self.lst_data[self.selindex].exported = sexported
                self.btnSaveCmd_clicked_cb(widget)
Exemplo n.º 2
0
    def btnAdd_clicked_cb(self, widget):
        sname = amutil.input_text(message="Enter a name for this command:")

        # No text, Item already exists, bad name?
        if self.item_badname(sname):
            return False

        # Add name to list with empty data
        cmd = amutil.Command()
        cmd.name = sname
        cmd.cmd = []
        cmd.comment = ""
        cmd.exported = "New"
        self.lst_data.append(cmd)

        # Reload aliases from lst_data
        self.load_aliases(False)
        self.stat_settext("Item added: " + sname)
        self.printlog("Item added: " + sname)
        # Select new item
        self.alias_select_byname(cmd.name)