示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 def reloadCurrentModule(self, event):
     CeciliaLib.openCeciliaFile(self, CeciliaLib.getVar("currentCeciliaFile"))
示例#5
0
 def onOpen(self, event, builtin=False):
     if isinstance(event, wx.CommandEvent):
         CeciliaLib.openCeciliaFile(self)
     elif os.path.isfile(event):
         CeciliaLib.openCeciliaFile(self, event, builtin)