def openRecent(self, event): menu = self.GetMenuBar() id = event.GetId() file = menu.FindItemById(id).GetLabel().replace("\n", "").strip() if os.path.isfile(file): CeciliaLib.openCeciliaFile(self, file) else: CeciliaLib.showErrorDialog("Error while trying to open a file!", "No such file : %s" % file[:-1]) self.newRecent(file, remove=True)
def onOpenBuiltin(self, event): menu = self.GetMenuBar() id = event.GetId() file = menu.FindItemById(id) filename = file.GetLabel() filedict = self.GetMenuBar().files for key in filedict.keys(): if filename in filedict[key]: dirname = key break name = os.path.join(CeciliaLib.ensureNFD(MODULES_PATH), dirname, filename) CeciliaLib.openCeciliaFile(self, name, True)
def onOpenPrefModule(self, event): menu = self.GetMenuBar() id = event.GetId() file = menu.FindItemById(id) filename = file.GetLabel() filedir = file.GetMenu().GetTitle() prefPath = CeciliaLib.getVar("prefferedPath") prefPaths = prefPath.split(';') prefBaseNames = [os.path.basename(path) for path in prefPaths] dirname = prefPaths[prefBaseNames.index(filedir)] if dirname: name = os.path.join(dirname, filename) CeciliaLib.openCeciliaFile(self, name)
def reloadCurrentModule(self, event): CeciliaLib.openCeciliaFile(self, CeciliaLib.getVar("currentCeciliaFile"))
def onOpen(self, event, builtin=False): if isinstance(event, wx.CommandEvent): CeciliaLib.openCeciliaFile(self) elif os.path.isfile(event): CeciliaLib.openCeciliaFile(self, event, builtin)