示例#1
0
def processDialog(node):
    name = title = dir = ""
    cmdlist = []

    for n in node.childNodes:
        if n.nodeName == 'name': name = getText(n.childNodes)
        elif n.nodeName == 'title': title = getText(n.childNodes)
        elif n.nodeName == 'dir': dir = getText(n.childNodes)
        elif n.nodeName == 'help': help = getText(n.childNodes)
        elif n.nodeName == 'button':
            cmdlist.append(getButton(n))
        elif n.nodeName == 'group':
            groupname = str(n.getAttribute("name"))
            buttonlist = []
            for g in n.childNodes:
                if g.nodeName == 'button':
                    buttonlist.append(getButton(g))
            group = [groupname, buttonlist]
            cmdlist.append(group)

    dialog = spiderDialog.Dialog(name=name,
                                 title=title,
                                 dir=dir,
                                 help=help,
                                 cmdlist=cmdlist)
    #if dialog.name == "Refinement":
    #   for item in cmdlist:
    #       print item

    return dialog
示例#2
0
    def editdialog(self, mode='edit'):
        dialog = None
        if mode == 'edit':
            d = self.box.getvalue()  # getvalue returns a tuple
            if len(d) > 0:
                dialogname = d[0]
                if dialogname != None and dialogname in self.config.Dialogs:
                    dialog = self.config.Dialogs[dialogname]
        elif mode == 'new':
            dialog = spiderDialog.Dialog()

        wintitle = "Edit Dialog"
        w = newWindow(wintitle)
        if w == 0: return
        # puts data in dialog, not df
        df = spiderDialog.DialogEditForm(w, dialog)
        #if hasattr(self, 'child_windows'):
        #   if df not in self.child_windows:
        #       self.child_windows.append(df)
        #else:
        #   self.child_windows = [df]
        w.wait_window(w)
        if df.result == "ok" and dialog != None:
            self.config.addDialog(dialog)
            if mode == 'new':
                # update the listbox
                dialogname = dialog.name
                if dialogname not in self.dialoglist:
                    self.dialoglist.append(dialogname)
                b = self.box.get()  # gets all values
                if dialogname not in b:
                    self.box.component('listbox').insert(END, dialogname)
                    self.box.component('listbox').see(END)
示例#3
0
def dir2dialog(d):
    " dir is of form [dirname [ f, f, [dir], [dir],..]] "
    dirname = d[0]
    dlist = d[1]
    D = spiderDialog.Dialog(name=dirname, title=dirname,
                            dir=dirname)  # create instance
    for item in dlist:
        if isSpiderBatchfile(item):
            button = [item, "Run", [item]]
            D.cmdlist.append(button)
    return D