~nagos/openshot/nagos

« back to all changes in this revision

Viewing changes to openshot/classes/project.py

  • Committer: Jonathan Thomas
  • Date: 2009-10-15 05:48:15 UTC
  • Revision ID: jonathan@jonathan64-20091015054815-he5csytxmcs8v03j
Bumped to version 0.9.52

Merged Andy's new "set_project_modified" code, which 
improves OpenShot's ability to prompt users to save projects
when exiting, and disables the save button when there are
no changes to save.

I had to extend this method to incorporate the "refresh xml"
flag which I had used previously to determine when the XML
needed to be re-generated.

The final method signature now looks like:
set_project_modified(is_modified=False, refresh_xml=False)

Removed right click menu for our transitions tree... which 
was left over code from the file tree.

New Project screen now defaults to the "Desktop" correctly
when creating a new project.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
                self.DESKTOP = os.path.join(os.path.expanduser("~"), "Desktop")
54
54
                self.USER_DIR = os.path.join(os.path.expanduser("~"), ".openshot")
55
55
                self.THEMES_DIR = os.path.join(self.BASE_DIR, "openshot", "themes")
56
 
                
57
 
#               print "----"
58
 
#               print "BASE_DIR: %s" % self.BASE_DIR
59
 
#               print "GLADE_DIR: %s" % self.GLADE_DIR
60
 
#               print "IMAGE_DIR: %s" % self.IMAGE_DIR
61
 
#               print "LOCALE_DIR: %s" % self.LOCALE_DIR
62
 
#               print "PROFILES_DIR: %s" % self.PROFILES_DIR
63
 
#               print "TRANSITIONS_DIR: %s" % self.TRANSITIONS_DIR
64
 
#               print "USER_DIR: %s" % self.USER_DIR
65
56
 
66
57
                # only run the following code if we are really using 
67
58
                # this project file... 
78
69
                        self.project_type = preferences.Settings.general["default_profile"]
79
70
                        self.theme = preferences.Settings.general["default_theme"]
80
71
                        self.canvas = None
81
 
                        self.is_modified = True
 
72
                        self.is_modified = False
 
73
                        self.refresh_xml = True
82
74
                        
83
75
                        # reference to the main GTK form
84
76
                        self.form = None
176
168
                state['USER_DIR'] = empty_project.USER_DIR
177
169
                state['DESKTOP'] = empty_project.DESKTOP
178
170
                state['THEMES_DIR'] = empty_project.THEMES_DIR
 
171
                state['refresh_xml'] = True
179
172
                
180
173
                
181
174
                empty_project = None
220
213
                f.close()
221
214
                
222
215
                # reset project as NOT modified
223
 
                self.is_modified = False
 
216
                self.refresh_xml = False
224
217
 
225
218
 
226
219
        #----------------------------------------------------------------------
229
222
                new XML file if the timeline has changed. """
230
223
                
231
224
                # has the project timeline been modified (i.e. new clips, re-arranged clips, etc...)
232
 
                if self.is_modified:
 
225
                if self.refresh_xml:
233
226
                        # generate a new MLT XML file
234
227
                        self.GenerateXML(os.path.join(self.USER_DIR, "westley.xml"))
235
228
 
272
265
                # call the open method
273
266
                open_project.open_project(self, file_path)      
274
267
 
 
268
                
 
269
        def set_project_modified(self, is_modified=False, refresh_xml=False):
 
270
                """Set the modified status and accordingly the save button sensitivity"""
 
271
                self.is_modified = is_modified
 
272
                self.refresh_xml = refresh_xml
 
273
 
 
274
                if is_modified == True:
 
275
                        self.form.tlbSave.set_sensitive(True)
 
276
                else:
 
277
                        self.form.tlbSave.set_sensitive(False)
 
278
                
 
 
b'\\ No newline at end of file'