def _onGetBranchesReply(self, repos, reply): """ Called when the list of branches is received. :param repos: the list of repositories :param reply: the reply from the server """ dialog = OpenDialog(self._plugin, repos, reply.branches) dialog.accepted.connect(partial(self._dialogAccepted, dialog)) dialog.exec_()
def openFolder(self, path=None): """ Ask the user to open a folder (directory) via the Open Folder dialog. Then open it in the tree, editor, and HTML preview windows. """ if not path: dialog = OpenDialog() dialog.set_folders_only(True) path = dialog.getExistingDirectory(self, "Open Folder", '') if path: self.handleFileChanged(path)
def openFile(self, path=None): """ Ask the user to open a file via the Open File dialog. Then open it in the tree, editor, and HTML preview windows. """ if not path: dialog = OpenDialog() dialog.set_folders_only(False) path = dialog.getOpenFileName( self, "Open File", '', "ReStructuredText Files (*.rst *.txt)") if path: file_path = Path(path[0]) filename = file_path.name tree_dir = file_path.parent.absolute() self.handleFileChanged(tree_dir, filename)
def openFolder(self, path=None): """ Ask the user to open a folder (directory) via the Open Folder dialog. Then open it in the tree, editor, and HTML preview windows. """ if not path: dialog = OpenDialog() dialog.set_folders_only(True) path = dialog.getExistingDirectory(self, "Open Folder", '') if path: self.handleFileChanged(path) #, filename='index.rst') with open('./config.json', 'r') as f: c = json.load(f) c['last_folder'] = path with open('./config.json', 'w') as f: json.dump(c, f)
def openFile(self, path=None): """ Ask the user to open a file via the Open File dialog. Then open it in the tree, editor, and HTML preview windows. """ if not path: dialog = OpenDialog() dialog.set_folders_only(False) path = dialog.getOpenFileName( self, "Open File", '', "ReStructuredText Files (*.rst *.txt)" ) if path: file_path = Path(path[0]) filename = file_path.name tree_dir = file_path.parent.absolute() self.handleFileChanged(tree_dir, filename)
def on_show(self): FORMAT = '%(asctime)s - %(levelname)s: %(message)s' logging.basicConfig(format=FORMAT, level=logging.DEBUG) log = logging.getLogger('tkplus-demo') def cool2(): print "GREETZ" def cool(): global f messagebox.show('hello world') f1 = Form(caption="New Form", left=320, top=200) btn1 = Button(f1, caption='Hello', left=5, top=5, width=200, height=100) btn1.on_click = cool2 btn1.background = 'blue' f1.show_modal() print "I'm a cool app" log.debug('demo app starting') f = Form(caption="Hello", width=640, height=480) f.caption = "Greetings" f.resizable = True f.form_type = SINGLE #img = Image(f, left=0, top=0, width=400, height=400, file='ok.gif') #img2 = Image(f, left=20, top=20, width=30, height=30, file='ok.gif') b = Button(f, caption="&Click Me", left=0, top=0, width=120, height=35) b.on_click = cool b.default = True b2 = Button(f, caption="Click &Me 2", left=0, top=40, width=120, height=35) def on_new(): print "HELLO" messagebox.show("NEW FILE") menu = MainMenu(f) filemenu = menu.create("File") filemenu.create("New", on_click=on_new) filemenu.separator() filemenu.create("Exit", on_click=f.close) def close_notify(): print "CLOSING" popup1 = PopupMenu(f) popup1.create("Click me", on_click=on_new) popup2 = PopupMenu(f) dlg = OpenDialog(f) dlg.multiple = True dlg.title = 'Pick a file' dlg.filter = 'Text Documents|*.txt' def raise_ex(): raise ValueError('If I had a nickel for every exception that was thrown...') b2.on_click = raise_ex #f.icon = 'notepad.ico' tv1 = TreeView(f, top=80, left=5, width=600, height=300) item = tv1.items.add('C:') item.add('Documents and Settings') item.add('Users').add('Todd Suess').add('Desktop') item.add('Windows').add('system32') sb = StatusBar(f) f.left, f.top = 0, 0 f.show()