Example #1
0
 def getFile(self):
     pattern = self.variable.get()
     if pattern.find('*') != -1:
         self.pattern = pattern
     if self.pattern is None:
         file = LoadFileDialog(self.parent).go()
     else:
         file = LoadFileDialog(self.parent).go(pattern=self.pattern)
     if file:
         if not self.expand:
             file = os.path.basename(file)
         self.variable.set(file)
Example #2
0
 def _open_file_dialog(self):
     dialog = LoadFileDialog(self._root, title='Choose file to view')
     fname = dialog.go()
     if fname is None:
         return
     self._path = os.path.abspath(fname)
     if self._last_update_cmd is not None:
         self._root.after_cancel(self._last_update_cmd)
     if self._file is not None:
         self._file.close()
     self._file = self._open_file(self._path)
     self._clear_text()
     if self._pause_cont_button['text'] == 'Continue':
         self._pause_or_cont()
     else:
         self._update()
Example #3
0
 def _open_file_dialog(self):
     dialog = LoadFileDialog(self._root, title="Choose file to view")
     fname = dialog.go()
     if fname is None:
         return
     self._path = os.path.abspath(fname)
     if self._last_update_cmd is not None:
         self._root.after_cancel(self._last_update_cmd)
     if self._file is not None:
         self._file.close()
     self._file = self._open_file(self._path)
     self._clear_text()
     if self._pause_cont_button["text"] == "Continue":
         self._pause_or_cont()
     else:
         self._update()
def openFile():
    '''
    Open a file for inspection
    Effect: open the file in a new window
    Return: the route of the file
    '''
    global filename
    fd = LoadFileDialog(fileButton)
    filename = fd.go()
    text = open(filename, 'r').read()
    newWindow = Tk.Tk()
    preview = Tk.Text(newWindow, width=80, height=40, wrap=Tk.NONE)
    scrollbarX = Tk.Scrollbar(newWindow, orient=Tk.HORIZONTAL)
    scrollbarY = Tk.Scrollbar(newWindow, orient=Tk.VERTICAL)
    scrollbarX.pack(side=Tk.BOTTOM, fill=Tk.X)
    scrollbarY.pack(side=Tk.RIGHT, fill=Tk.Y)
    preview.config(xscrollcommand=scrollbarX.set)
    preview.config(yscrollcommand=scrollbarY.set)
    scrollbarX.config(command=preview.xview)
    scrollbarY.config(command=preview.yview)
    preview.pack(fill=Tk.BOTH)
    preview.insert(Tk.INSERT, str(text))
Example #5
0
File: tkdu.py Project: zeehio/tkdu
 def __init__(self, master, title=None):
     LoadFileDialog.__init__(self, master, title)
     self.files.destroy()
     self.filesbar.destroy()
Example #6
0
 def browse(self):
     file = LoadFileDialog(self).go(pattern='*')
     if file:
         self.filename.set(file)
Example #7
0
File: tkdu.py Project: lyupin/tkdu
 def __init__(self, master, title=None):
     LoadFileDialog.__init__(self, master, title)
     self.files.destroy()
     self.filesbar.destroy()