예제 #1
0
def getFilesToProcess():

    root = tk.Tk()
    root.withdraw()
    root.update()

    d = Dialog(title="Select input for processing",
               text="Select file(s) or folder for processing",
               bitmap='question',
               strings=('Files', 'Folder', 'Cancel'),
               default=0)

    files = None
    if (d.num == 0):
        files = askopenfilename(title="Choose a set of file to process",
                                multiple=1,
                                filetypes=(("sqlite files", "*.sqlite"),
                                           ("all files", "*.*")))

    if (d.num == 1):

        folder = askdirectory(title="Choose a directory to process")
        print("Folder: ", folder)
        folder = folder + "/**/*.sqlite"
        print("Fetching files...")
        files = []
        for file in glob.glob(folder, recursive=True):
            print(file, "found.")
            files.append(file)

    d.destroy()
    root.destroy()

    return files
예제 #2
0
 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'))
예제 #3
0
 def _setVar(self):
     self._observable.set(self._var.get())
     Dialog(self,
                   title="Hello",
                   text="I'm set to %s"%self._var.get(),
                   bitmap=DIALOG_ICON,
                   default=0, strings=('OK',))
예제 #4
0
    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
예제 #5
0
 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()
예제 #6
0
 def no_process(self):
     Dialog(self.master,
            text="No active process",
            title="No process",
            bitmap='error',
            default=0,
            strings=('OK', ))
예제 #7
0
 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)
예제 #8
0
 def dialog1(self):
     answer = Dialog(self,
                     title='PopUp Fun',
                     text='An example of popup-dialog box (old)',
                     bitmap='questhead',
                     default=0, strings=('Yes', 'No', 'Cancel'))
     if answer.num == 0:
         self.dialog2()
예제 #9
0
파일: ui_utils.py 프로젝트: byache/thonny
    def __init__(self, title, prompt,
                 initialvalue=None,
                 minvalue = None, maxvalue = None,
                 master = None,
                 selection_range=None):

        if not master:
            master = tk._default_root

        self.prompt   = prompt
        self.minvalue = minvalue
        self.maxvalue = maxvalue

        self.initialvalue = initialvalue
        self.selection_range = selection_range

        Dialog.__init__(self, master, title)
예제 #10
0
 def menudoc(self):
     Dialog(
         self.root,
         title='说明',
         text=
         '      本软件可以查询DOI是否正式生效,在“单次查询”模式中为点击按钮触发查询,在“循环查询”模式中可以设定扫描时间,自动隔一段时间查询是否生效。',
         bitmap='info',
         default=0,
         cancel=3,
         strings=('  关   闭  ', ))
예제 #11
0
 def menuabout(self):
     # self.root.tk.call('wm', 'iconphoto', self.root._w, tk.PhotoImage(file='1.gif'))
     # messagebox.showinfo('关于', '版本:V 0.3\n时间:2020年10月1日\n作者:小山神')
     Dialog(self.root,
            title='关于',
            text='版本:V 0.3\n时间:2020年10月1日\n作者:小山神',
            bitmap='',
            default=0,
            cancel=3,
            strings=('  关   闭  ', ))
예제 #12
0
 def reg(self):
     s1 = self.userEntry.get()
     s2 = self.pwEntry.get()
     if s1 == "www.google.com" and s2 == "www.bing.com":
         self.logLabel["text"]="登录成功"
     else:
         self.logLabel["text"]="用户名或密码错误"
         self.userEntry.delete(0,len(s1))
         self.pwEntry.delete(0,len(s1))
         d = Dialog(None,title = "错误信息",text = "用户名或密码错误",
             default=0,strings = ("重来","放弃"))
예제 #13
0
 def show_alert(self,
                text,
                strings=("OK", ),
                title="Alert",
                bitmap=DIALOG_ICON,
                default=0):
     return Dialog(self.window,
                   text=text,
                   title=title,
                   bitmap=bitmap,
                   default=default,
                   strings=strings)
예제 #14
0
def getCsvFileToProcess():
    root = tk.Tk()
    root.withdraw()
    root.update()

    d = Dialog(title="Select csv file for processing",
               text="Select csv file for processing",
               bitmap='question',
               strings=('File', 'Cancel'),
               default=0)

    root.focus_force()
    file = None
    if (d.num == 0):
        file = askopenfilename(title="Choose a csv file to process",
                               multiple=0,
                               filetypes=(("csv files", "*.csv"), ("all files",
                                                                   "*.*")))

    d.destroy()
    root.destroy()

    return file
예제 #15
0
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.master = master
        Pack.config(self)  # same as self.pack()
        self.ans = Dialog(self,
                          title='Memory Simulator',
                          text='Select your option',
                          bitmap='questhead',
                          default=0,
                          strings=('Load from file', 'Enter code in console',
                                   'Cancel'))

        if self.ans.num == 1:
            master.geometry("1600x1000")
            self.createWidgets(master)
예제 #16
0
파일: frame.py 프로젝트: pq27120/job_comm
 def show_dialog(self):
     dialog = Dialog(parent=self)
     if dialog.exec_():
         # print dialog.name() + ' ' + dialog.sql_type()
         return_sql = self.create_sql(dialog.name(), dialog.sql_type())
         if self.model.rowCount() > 0:
             self.model.removeRow(self.model.rowCount() - 1)
         self.model.appendRow((
             QtGui.QStandardItem(return_sql)
         ))
         self.table.resizeColumnsToContents()  # 将列调整到跟内容大小相匹配
     dialog.destroy()
예제 #17
0
 def ok_command(self):
     file = self.get_selection()
     if os.path.exists(file):
         if os.path.isdir(file):
             self.master.bell()
             return
         d = Dialog(self.top,
                    title="Overwrite Existing File Question",
                    text="Overwrite existing file %r?" % (file, ),
                    bitmap='questhead',
                    default=1,
                    strings=("Yes", "Cancel"))
         if d.num != 0:
             return
     else:
         head, tail = os.path.split(file)
         if not os.path.isdir(head):
             self.master.bell()
             return
     self.quit(file)
예제 #18
0
 def send_code(self):
     Dialog(None, title="Выбери!", text="Кому выслать код?", strings=open_config()["admins"], bitmap="questhead", default=0)
예제 #19
0
 def select(cls, text, strings: list or dict):
     Dialog(None, title="Выбери!", text=text, strings=strings, bitmap="questhead", default=0)
예제 #20
0
 def destroy(self):
     self.entry = None
     Dialog.destroy(self)