def filesavedialog(self, filetype, skel, startdir='', default=None): # FIXED: from string import replace print("pyrobot/gui/TK.py filesaveddialog") #DEBUG import string import pyrobot from os import getcwd, getenv, chdir retval = "" cwd = getcwd() if startdir == '': chdir(pyrobot.pyrobotdir() + "/plugins/" + filetype) else: chdir(startdir) d = TKwidgets.SaveFileDialog(self, "Save " + filetype, skel, defaultFilename=default) try: if d.Show() == 1: doc = d.GetFileName() d.DialogCleanup() retval = doc else: d.DialogCleanup() except: # double-click bug. What should we do? doc = d.GetFileName() d.DialogCleanup() retval = doc chdir(cwd) return retval
def fileloaddialog(self, filetype, skel, startdir=''): from string import replace import pyrobot from os import getcwd, getenv, chdir retval = "" cwd = getcwd() if startdir == '': chdir(pyrobot.pyrobotdir() + "/plugins/" + filetype) else: chdir(startdir) d = TKwidgets.LoadFileDialog(self, "Load " + filetype, skel, \ pyrobot.pyrobotdir() + "/plugins/" + filetype) try: retval = d.Show() if retval == 1: doc = d.GetFileName() d.DialogCleanup() retval = doc else: d.DialogCleanup() except: print "failed!" # double-click bug. What should we do? doc = d.GetFileName() d.DialogCleanup() retval = doc chdir(cwd) return retval
def ask(title, qlist): d = TKwidgets.AskDialog(share.gui, title, qlist) d.top.bind("<Return>", lambda event: d.OkPressed()) ok = d.Show() if ok: retval = {"ok": 1} for (name, value) in qlist: retval[name] = d.textbox[name].get() d.DialogCleanup() return retval else: d.DialogCleanup() return {"ok": 0}
def fileloaddialog(self, filetype, skel, startdir=''): # FIXED: string import replace import string import pyrobot from os import getcwd, getenv, chdir retval = "" cwd = getcwd() if startdir == '': chdir(pyrobot.pyrobotdir() + "/plugins/" + filetype) else: print("startdir") #DEBUG chdir(pyrobot.pyrobotdir() + "/plugins/" + filetype) #DEBUG print(startdir) #DEBUG #chdir(startdir) print( "gui/TK.py - fileloaddialog : File Load dialog mean server.. Robot.. Brain" ) #DEBUG d = TKwidgets.LoadFileDialog(self, "Load " + filetype, skel, \ pyrobot.pyrobotdir() + "/plugins/" + filetype) print("gui/TK.py - fileloaddialog") #DEBUG print("gui/TK.py - d values") #DEBUG print(d) #DEBUG try: retval = d.Show() print("d.show()") #DEBUG print(retval) #DEBUG if retval == 1: print("gui/TK.py") #DEBUG print("gui/TK.py, print d") #DEBUG print(d) #DEBUG print(" retval == 1") #DEBUG doc = d.GetFileName() print(" print doc") #DEBUG print(doc) #DEBUG d.DialogCleanup() retval = doc else: d.DialogCleanup() except: print(" fail occured") #DEBUG # double-click bug. What should we do? doc = d.GetFileName() d.DialogCleanup() retval = doc chdir(cwd) return retval
def fileloaddialog(self, filetype, skel, startdir = ''): from string import replace from os import getcwd, getenv, chdir retval = "" cwd = getcwd() if startdir == '': chdir(pyrobotdir() + "/plugins/" + filetype) else: chdir(startdir) d = TKwidgets.LoadFileDialog(self, "Load " + filetype, skel, pyrobotdir() + "/plugins/" + filetype) if d.Show() == 1: doc = d.GetFileName() d.DialogCleanup() retval = doc else: d.DialogCleanup() chdir(cwd) return retval
def makeWatcher(self): if self.watcher: self.watcher.deiconify() else: self.watcher = TKwidgets.Watcher(self)