Beispiel #1
0
 def on_project_new(self):
     try:
         if self.project.modified and self.ask_savechanges():
             self.on_project_save()
         self.close_project()
         self.open_project(Project())
         action_list.clear()
     except Cancel:
         return
Beispiel #2
0
    def open_project(self, project):
        """Open a project in the main window"""
        self.project = project

        self.project.connect('remove-item', self.on_project_remove_item)
        self.project.connect('modified', lambda: self.on_project_modified(True), True)
        self.project.connect('not-modified', lambda: self.on_project_modified(False), True)

        action_list.clear()

        self.emit('open-project', self.project)
Beispiel #3
0
 def on_project_saveas(self):
     try:
         dlg = wx.FileDialog(self._widget, message="Choose a file", defaultDir=os.getcwd(), 
                             defaultFile="", wildcard="All Files|*.*|Projects|*.mk", style=wx.SAVE | wx.CHANGE_DIR)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPaths()[0]
             self.project.saveto(path)
             self.open_project(Project(str(path)))
             action_list.clear()
         dlg.Destroy()
     except Cancel:
         return
Beispiel #4
0
    def open_project(self, project):
        """Open a project in the main window"""
        self.project = project

        self.project.connect('remove-item', self.on_project_remove_item)
        self.project.connect('modified',
                             lambda: self.on_project_modified(True), True)
        self.project.connect('not-modified',
                             lambda: self.on_project_modified(False), True)

        action_list.clear()

        self.emit('open-project', self.project)
Beispiel #5
0
    def on_project_open(self):
        try:
            if self.project.modified and self.ask_savechanges():
                self.on_project_save()

            dlg = wx.FileDialog(self._widget, message="Choose a file", defaultDir=os.getcwd(), 
                                defaultFile="", wildcard="All Files|*.*|Projects|*.gt", style=wx.OPEN | wx.CHANGE_DIR)
            if dlg.ShowModal() == wx.ID_OK:
                path = dlg.GetPaths()[0]
                self.close_project()
                self.open_project(Project(str(path)))
                action_list.clear()
            dlg.Destroy()
        except Cancel:
            return