def ShowOff(self,arg1, arg2,arg3): MenuHeight = len(self.items) MenuWidth = self.maxLength X = self.X Y = self.Y + 1 Parent = self.PARENT Screen = Parent.SCREEN self.myscreen = Screen.CaptureScreen( Y, X, Y + MenuHeight , X + MenuWidth ) MenuWin = Dialog(Parent, Y, X, Y + MenuHeight, X + MenuWidth ) MenuWin.SetColor(Screen.colors.C_MENUBAR) count = 1 self.EXITFORM = 0 for i in range(len(self.items)): text = '' if self.items[i][0] == -1: text = (self.maxLength - 2) * chr(tiHLINE) else: newTitle = self.items[i][1] text = self.__FixDisplay(newTitle) item = MenuItem(MenuWin,str(self.items[i][0]),count-1,0,text, self.items[i][2]) item.ITEMID = self.items[i][0] count += 1 item.SetMethod("CLICK",self.ItemSelected) item.SetMethod("GOTFOCUS",self.ItemFocused) MenuWin.AddControl(item) item.DeActivate(self.items[i][3]) ## MenuWin.INSET = 1 MenuWin.DROPSHADOW=0 r =MenuWin.RunDialog() Parent.Paint() Parent.Screen().Refresh()
def __init__(self, connectionData, parent): Dialog.__init__(self, parent) self.cd = connectionData self.setLayout(QVBoxLayout(self)) self.gb = QGroupBox(self) self.gb.setTitle(self.tr('Database Connection')) self.bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) self.bb.accepted.connect(self.accept) self.bb.rejected.connect(self.reject) self.layout().addWidget(self.gb) self.layout().addWidget(self.bb) self.setupWidgets() self.hostW.setText(unicode(self.cd.host)) self.portW.setText(unicode(self.cd.port)) self.dbW.setText(unicode(self.cd.dbName)) self.schemaW.setText(unicode(self.cd.schema)) self.loginW.setText(unicode(self.cd.user)) self.passwordW.setText(unicode(self.cd.password)) if self.cd.createSchema: self.createSchemaW.setCheckState(Qt.Checked) if self.cd.insertTemplateData: self.insertTemplateDataW.setCheckState(Qt.Checked) self.passwordW.setFocus()
def remover(self): nome = self.nome.get() if not len(nome): Dialog(self, title="Erro!", text="Nome inválido", bitmap='error', default=0, strings=('OK', )) return if not self.db.has_key(nome): Dialog(self, title="Erro!", text="Nome não encontrado", bitmap='error', default=0, strings=('OK', )) return self.endereco.set(self.db.get(nome, "")[0]) self.telefone.set(self.db.get(nome, "")[1]) resposta = Dialog(self, title="Confirmação", text="Deseja remover?", bitmap='question', default=1, strings=('Sim', 'Não')) if resposta.num == 0: del self.db[nome] self.limpaCampos()
def __init__(self, master, filename): Dialog.__init__(self, master, title='File Format change', text='File ' + filename + 'Not Video Format', bitmap='warning', default=0, strings=('Cancel', ))
def openDialogWindow(self): if self.DialogWindow != None: self.DialogWindow.show() return self.DialogWindow = Dialog() self.DialogWindow.show() qe = QEventLoop() qe.exec_()
def main(): app = QtGui.QApplication(sys.argv) dlg = Dialog() dlg.show() sys.exit(app.exec_()) pass
def __init__(self, master): Dialog.__init__(self, master, title='File not Selected', text='File not seletecd', bitmap='warning', default=0, strings=('Cancel', ))
def __init__(self, master, filename): Dialog.__init__(self, master, title='File not found', text='File ' + filename + ' does not exist', bitmap='warning', default=0, strings=('Cancel', ))
def queryNumberOfColors(self): """Ask the user how many colors to use for secret pattern.""" inputOptions = [] for i in range(2, len(self._colorNames) + 1): inputOptions.append(str(i)) dialog = Dialog('How many colors are available?', inputOptions, 'Number of color', 500) self._numberOfColors = int(dialog.display()) return self._numberOfColors
def main(): dialog = Dialog() panel = Panel() ok = Button("Ok") cancel = Button("Cancel") panel.add_children(ok) panel.add_children(cancel) dialog.add_children(panel) ok.show_help()
def load_all_dialog(file_path): f = open(file_path,'r') r = f.read() f.close() j = loads(r) dialogs = [] for dialog_json in j: d = Dialog() d.load(dialog_json) dialogs.append(d) return dialogs
def gravar(self): nome = self.nome.get() if not len(nome): Dialog(self, title="Erro!", text="Nome inválido", bitmap= 'error', default=0, strings=('OK',)) return if not db.has_key(nome): Dialog(self, title="Erro!",\ text="Nome inexistente, adicione um novo contanto",\ bitmap= 'error', default= 0 strings = ('OK',)) return self.db[nome]=(self.endereco.get(),self.teçefone.get()) self.limparCampos()
def procurar(self): nome = self.nome.get() if not len(nome): Dialog(self, title="Erro!", text="Nome não encontrado", \ bitmap='Error', default=0, strings=('OK',) ) return if not self.db.has_key(nome): Dialog(self, title="Erro!", text="Nome não encontrado", \ bitmap ='error', default=0, strings= ('OK',)) return self.telefone.set(self.db.set(nome, "")[0]) self.endereco.set(self.db.set(nome, "")[1])
def adicionar(self): nome = self.nome.get() if not nome: Dialog(self, title="Erro!", text="Nome inválido", \ bitmap='error', default=0, strings=('OK',)) return if nome in self.db: Dialog(self, title="Erro!", text="Nome já cadastrado", \ bitmap='error', default=0, strings=('OK',)) return self.db[nome] = (self.endereco.get(), self.telefone.get()) self.limpaCampos()
def gravar(self): nome = self.nome.get() if not nome: Dialog(self, title="Erro!", text="Nome inválido", bitmap='error', default=0, strings=('OK',)) return if nome not in self.db: Dialog(self, title="Erro!", \ text="Nome inexistente, use o botão adicionar", \ bitmap='error', default=0, strings=('OK',)) return self.db[nome] = (self.endereco.get(), self.telefone.get()) self.limpaCampos()
def ok_command(self): file = self.get_selection() if os.path.exists(file): if os.path.isdir(file): self.top.bell() return d = Dialog(self.top, title="File Exists", text="Overwrite existing file %s?" % ` file `, bitmap='questhead', default=1, strings=("Overwrite", "Append", "Cancel")) if d.num == 2: return elif d.num == 0: self.mode = 'w' elif d.num == 1: self.mode = 'a' else: head, tail = os.path.split(file) if not os.path.isdir(head): self.top.bell() return self.mode = 'w' self.quit(file)
def no_process(self): Dialog(self.master, text="No active process", title="No process", bitmap='error', default=0, strings=('OK',))
def outputhandler(self, file, mask): data = os.read(file, BUFSIZE) if not data: self.tk.deletefilehandler(file) pid, sts = os.waitpid(self.pid, 0) print 'pid', pid, 'status', sts self.pid = None detail = sts>>8 cause = sts & 0xff if cause == 0: msg = "exit status %d" % detail else: msg = "killed by signal %d" % (cause & 0x7f) if cause & 0x80: msg = msg + " -- core dumped" Dialog(self.master, text=msg, title="Exit status", bitmap='warning', default=0, strings=('OK',)) return self.insert(END, data) self.pos = self.index("end - 1 char") self.yview_pickplace(END)
def quit(self): ans = Dialog(self, title='Verify quit ', text='Are you sure you want to quit?', bitmap='question', default=1, strings=('Yes', 'No'))
def outputhandler(self, file, mask): data = os.read(file, BUFSIZE) if not data: self.tk.deletefilehandler(file) pid, sts = os.waitpid(self.pid, 0) print 'pid', pid, 'status', sts self.pid = None detail = sts>>8 cause = sts & 0xff if cause == 0: msg = "exit status %d" % detail else: msg = "killed by signal %d" % (cause & 0x7f) if cause & 0x80: msg = msg + " -- core dumped" Dialog(self.master, { 'text': msg, 'title': "Exit status", 'bitmap': 'warning', 'default': 0, 'strings': ('OK',), }) return self.insert('end', data) self.pos = self.index('end') self.yview_pickplace('end')
def dialog2(self): Dialog(self, title='title', text="text", bitmap='hourglass', default=0, strings=('spam', 'SPAM'))
def notdone(self): Dialog(self, title='Not implemented', text='Not yet available', bitmap='error', default=0, strings=('OK', ))
def sair(self): resposta = Dialog(self, title="Confirmação", text="Tem certeza que deseja sair?", bitmap='question', default=1, strings=('Sim', 'Não')) if resposta.num == 0: self.quit()
def dialog1(self): ans = Dialog(self, title = 'Title!', text = 'text' 'and text "quotation".', bitmap = 'questhead', default = 0, strings = ('Yes', 'No', 'Cancel'))
def infobox(self, title, text, bitmap='', strings=('OK', )): Dialog(self, title=title, text=text, bitmap=bitmap, default=0, strings=strings)
def question(self, title, text, bitmap='question', strings=('Yes', 'No')): return Dialog(self, title=title, text=text, bitmap=bitmap, default=1, strings=strings).num
def greeting(self): Dialog(self, title='greeting', text='Howdy', bitmap='', default=0, strings=('hi', ))
def makeWindow(self): """Create a top-level dialog with some buttons. This uses the Dialog class, which is a wrapper around the Tcl/Tk tk_dialog script. The function returns 0 if the user clicks 'yes' or 1 if the user clicks 'no'. """ # the parameters to this call are as follows: d = Dialog( self, ## name of a toplevel window title="fred the dialog box", ## title on the window text="click on a choice", ## message to appear in window bitmap="info", ## bitmap (if any) to appear; ## if none, use "" # legal values here are: # string what it looks like # ---------------------------------------------- # error a circle with a slash through it # grey25 grey square # grey50 darker grey square # hourglass use for "wait.." # info a large, lower case "i" # questhead a human head with a "?" in it # question a large "?" # warning a large "!" # @fname X bitmap where fname is the path to the file # default=0, # the index of the default button choice. # hitting return selects this strings=("yes", "no")) # values of the 'strings' key are the labels for the # buttons that appear left to right in the dialog box return d.num
def dialog2(self): Dialog(self, title='HAL-9000', text="I'm afraid I can't let you do that, Dave", bitmap='hourglass', default=0, strings=('spam', 'SPAM'))
def dialog1(self): ans = Dialog(self, title = 'Popup Fun!', text = 'An example of a popup-dialog ' 'box, using older "Dialog.py".', bitmap = 'questhead', default = 0, strings = ('Yes', 'No', 'Cancel')) if ans.num == 0: self.dialog2()
def remover(self): nome = self.procurar() resposta = Dialog(self, title="Confirmação", \ text="Deseja remover?", \ bitmap='question', default=1, strings=('Sim', 'Não')) if resposta.num == 0: del self.db[nome] self.limpaCampos()
def dialog1(self): ans = Dialog(self, title='popup fun!', text='an example', bitmap='questhead', default=0, strings=('yes', 'no', 'cancel')) if ans.sum == 0: self.dialog2()
def __init__(self, title, parent, callback, callback_data=None): Dialog.__init__(self, title, modal=True, exit_callback=self.callback_exit, exit_data=callback_data) self.queue = Queue.Queue(1024) self.mode = "PULSE" self.status_counter = Counter.Counter() self._callback = callback self.progress_bar = gtk.ProgressBar() self.hbox_buttons.pack_start(self.progress_bar, True, True, 2) self.add_button_right("Cancel", self.callback_cancel) self.add_button_hidden("update", self.callback_update_progress, hide=False) self.add_button_hidden("done", self.callback_done) self.status_bar = gtk.Statusbar() self.vbox_main.pack_end(self.status_bar, False, True, 2) self.result = "UNKNOWN"
def __init__(self, main_instance): AbstractRole.__init__(self, main_instance) self.dialog = Dialog(self) self.has_run = False self.server = None self.ssl_ctx = None self.processes = {} self.kill_mutex = threading.Lock()
def procurar(self): busca = self.nome.get() if not busca: Dialog(self, title="Erro!", text="Nome inválido", \ bitmap='error', default=0, strings=('OK',)) return try: nome, endereco, telefone = self._busca(busca) except NotFound: Dialog(self, title="Erro!", text="Nome não encontrado", \ bitmap='error', default=0, strings=('OK',)) return self.nome.set(nome) self.endereco.set(endereco) self.telefone.set(telefone) return nome
def __init__(self, parent, fields=[], title=None): self.fields = sorted(fields, key=str.lower) Dialog.__init__(self, parent, title)
def __init__(self, parent, entity): Dialog.__init__(self, parent) self.entity = entity self.setLayout(QVBoxLayout(self))