예제 #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)