def __init__(self, parent): qt.QtGui.QDialog.__init__(self, parent) ui_preferences.Ui_Preferences.__init__(self) self.setupUi(self) # Read config config = Settings() self.session = parent.session # pkgmanager try: str = config.get("pkgmanager", "path") l = eval(str) for p in l: self.pathList.addItem(p) except: pass # try: #str = config.get("pkgmanager", "include_namespace") #enabled = bool(eval(str)) # if(enabled): # self.includenmspace.setCheckState(qt.QtCore.Qt.Checked) # else: # self.includenmspace.setCheckState(qt.QtCore.Qt.Unchecked) # except: # pass # Editor try: str = config.get("editor", "use_external") l = eval(str) if (l): self.externalBool.setCheckState(qt.QtCore.Qt.Checked) else: self.externalBool.setCheckState(qt.QtCore.Qt.Unchecked) except Exception, e: print e
def __init__(self, parent): qt.QtGui.QDialog.__init__(self, parent) ui_preferences.Ui_Preferences.__init__(self) self.setupUi(self) # Read config config = Settings() self.session = parent.session # pkgmanager try: str = config.get("pkgmanager", "path") l = eval(str) for p in l: self.pathList.addItem(p) except: pass # try: # str = config.get("pkgmanager", "include_namespace") # enabled = bool(eval(str)) # if(enabled): # self.includenmspace.setCheckState(qt.QtCore.Qt.Checked) # else: # self.includenmspace.setCheckState(qt.QtCore.Qt.Unchecked) # except: # pass # Editor try: str = config.get("editor", "use_external") l = eval(str) if l: self.externalBool.setCheckState(qt.QtCore.Qt.Checked) else: self.externalBool.setCheckState(qt.QtCore.Qt.Unchecked) except Exception, e: print e
def test_write_config(): pkgman = PackageManager() pkgman.load_directory("./") pkgman.write_config() p = pkgman.user_wralea_path s = Settings() path = s.get("pkgmanager", "path") paths = list(eval(path)) # path is a string assert set(paths) == set(p)
def get_editor(): """ Return the editor class """ editor = PythonCodeEditor s = Settings() try: str = s.get('editor', 'use_external') l = eval(str) if(l): editor = ExternalCodeEditor except: pass return editor
def read_settings(self): """Read application settings. """ settings = Settings() #main window try: size = eval(settings.get("MainWindow", "size")) self.resize(qt.QtCore.QSize(*size)) except NoSectionError: pass except NoOptionError: pass try: pos = eval(settings.get("MainWindow", "pos")) self.move(qt.QtCore.QPoint(*pos)) except NoSectionError: pass except NoOptionError: pass try: sizes = eval(settings.get("MainWindow", "splitter_2")) self.splitter_2.setSizes(sizes) except NoSectionError: pass except NoOptionError: pass try: sizes = eval(settings.get("MainWindow", "splitter_3")) self.splitter_3.setSizes(sizes) except NoSectionError: pass except NoOptionError: pass #workspace try: last_open = eval(settings.get("WorkSpace", "last")) last_open.reverse() for item in last_open: gr = item.split(".") pkgid = ".".join(gr[:-1]) name = gr[-1] self.add_last_open(pkgid, name) except NoSectionError: pass except NoOptionError: pass try: prov = eval(settings.get("Provenance", "enable")) self.set_provenance(bool(prov)) except NoSectionError: pass except NoOptionError: pass
def get_command(self): """ Return command to execute """ s = Settings() cmd = "" try: cmd = s.get('editor', 'command') except: cmd = "" if(not cmd): if('posix' in os.name): return "/usr/bin/vim" else: return "C:\\windows\\notepad.exe" return cmd
def mouseDoubleClickEvent(self, event): if event.button() == qt.QtCore.Qt.LeftButton: # Read settings try: localsettings = Settings() str = localsettings.get("UI", "DoubleClick") except: str = "['open']" operator = GraphOperator(graph=self.graph(), graphScene=self.scene()) operator.set_vertex_item(self) if('open' in str): operator(fName="vertex_open")() elif('run' in str): operator(fName="vertex_run")()
def mouseDoubleClickEvent(self, event): if event.button() == qt.QtCore.Qt.LeftButton: # Read settings try: localsettings = Settings() str = localsettings.get("UI", "DoubleClick") except: str = "['open']" operator = GraphOperator(graph=self.graph(), graphScene=self.scene()) operator.set_vertex_item(self) if ('open' in str): operator(fName="vertex_open")() elif ('run' in str): operator(fName="vertex_run")()
def set_user_wralea_path(self): """ Read user config """ if self.user_wralea_path: return if not SEARCH_OUTSIDE_ENTRY_POINTS: return self.user_wralea_path = set() config = Settings() l = [] # wralea path try: s = config.get("pkgmanager", "path") l = eval(s) except NoSectionError: config.add_section("pkgmanager") config.add_option("pkgmanager", "path", str([])) except NoOptionError: config.add_option("pkgmanager", "path", str([])) for p in l: self.add_wralea_path(os.path.abspath(p), self.user_wralea_path)