Example #1
0
	def __init__(self, folder_name, project=None):
		"""Constructor for the theme object """

		# Find the Theme XML file
		self.folder_name = folder_name
		self.project = project
		self.theme_path = os.path.join(self.project.THEMES_DIR, folder_name)
		self.theme_xml_path = os.path.join(self.project.THEMES_DIR, folder_name, "theme.xml")
		
		# dictionary to hold theme settings
		self.settings = {}
		
		try:
			# Load the Theme XML file
			self.xmldoc = minidom.parse(self.theme_xml_path)
			
			# get timeline settings
			self.settings["timeline"] = self.get_timeline_settings()
			
			# get track settings
			self.settings["track"] = self.get_track_settings()
			
			# get clip settings
			self.settings["clip"] = self.get_clip_settings()
			
			# get transitions settings
			self.settings["transition"] = self.get_transition_settings()
			
		except:
			# Show friendly error message
			messagebox.show(_("Error!"), _("Unable to load theme XML file: %s.  OpenShot will use the blue_glass XML theme file instead.") % self.theme_xml_path)
			print "Unable to load theme XML file: %s.  OpenShot will use the blue_glass XML theme file instead." % self.theme_xml_path
			
			# clear any half-filled settings dictionary
			self.settings = {}
Example #2
0
 def button_unmount_clicked(self, data):
     try:
         imageaction.unmount(self.interface.get_widget('label_selected_mount_point').get_label(), self.is_mounted_image_fuse, self.image_storage, self.iter)
         self.interface.get_widget('label_selected_mount_point').set_label(_('No Mount Point Selected'))
         self.interface.get_widget('button_unmount').set_sensitive(False)
     except:
         messagebox.show(self.interface.get_widget('main_window'), _('Error unmounting image.\nUnexpected error: %s' % (sys.exc_info()[0])), gtk.MESSAGE_ERROR)
Example #3
0
 def verify_image(self, image=''):
     if image == '':
         selected_file = self.interface.get_widget('comboentry_image').get_active_text()
     else:
         selected_file = image
     # First, ensure that the file exists
     if not os.path.exists(selected_file):
         messagebox.show(self.interface.get_widget('main_window'), _('File not found. \nPlease check source exists.'), gtk.MESSAGE_ERROR)
         self.interface.get_widget('label_selected_image').set_label(_('No Image Selected'))
         self.interface.get_widget('button_mount').set_sensitive(False)
         self.interface.get_widget('button_checksum').set_sensitive(False)
         self.interface.get_widget('button_burn').set_sensitive(False)
         return False
     # Next, ensure it's a supported image
     if selected_file.lower().endswith('.iso') | selected_file.lower().endswith('.img') | selected_file.lower().endswith('.bin') | selected_file.lower().endswith('.mdf') | selected_file.lower().endswith('.nrg'):
         self.interface.get_widget('label_selected_image').set_label(selected_file)
         self.interface.get_widget('button_mount').set_sensitive(True)
         self.interface.get_widget('button_checksum').set_sensitive(True)
         self.interface.get_widget('button_burn').set_sensitive(True)
         # Loop method only supports ISO and IMG, so...
         if selected_file.lower().endswith('.iso') | selected_file.lower().endswith('.img'):
             self.interface.get_widget('radiobutton_loop').set_sensitive(True)
         else:
             self.interface.get_widget('radiobutton_loop').set_sensitive(False)
             self.interface.get_widget('radiobutton_fuse').set_active(True)
         return True
     messagebox.show(self.interface.get_widget('main_window'), _('File does not appear to be a compatible Image. \nPlease check source.'), gtk.MESSAGE_ERROR)
     self.interface.get_widget('label_selected_image').set_label(_('No Image Selected'))
     self.interface.get_widget('button_mount').set_sensitive(False)
     self.interface.get_widget('button_checksum').set_sensitive(False)
     self.interface.get_widget('button_burn').set_sensitive(False)
     return False
Example #4
0
 def cool():
     global f
     messagebox.show('hello world')
     f1 = Form(caption="New Form", left=320, top=200)
     btn1 = Button(f1, caption='Hello', left=5, top=5, width=200, height=100)
     btn1.on_click = cool2
     btn1.background = 'blue'
     f1.show_modal()
     print "I'm a cool app"
Example #5
0
    def create_settings_directory(self):

        #Create settings directory if not present
        if not os.path.exists(globals.settings_directory):
            try:
                os.mkdir(globals.settings_directory)
            except OSError, (errno, strerror):
                messagebox.show(self.interface.get_widget('main_window'), _('Error creating settings directory.\nOS error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
            except IOError, (errno, strerror):
                messagebox.show(self.interface.get_widget('main_window'), _('Error creating settings directory.\nIO error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
Example #6
0
 def create_settings_file(self):
     
     #Create the setting file if it doesn't exist
     if not os.path.exists(globals.settings_file):
         try:
             settings_object = open(globals.settings_file, 'w')
             mount_point_setting = '[mount_options]\nmount_point: %s' % globals.home_directory
             settings_object.write(mount_point_setting);
             log.write(globals.mount_log, _('New settings file created at %s' % globals.settings_file))
         except OSError, (errno, strerror):
             messagebox.show(self.interface.get_widget('main_window'), _('Error creating settings file.\nOS error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
         except IOError, (errno, strerror):
             messagebox.show(self.interface.get_widget('main_window'), _('Error creating settings file.\nIO error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
Example #7
0
    def treeview_mounted_images_drag_data_recieved(self, widget, context, x, y, sel, ttype, time):
        files = sel.data.split('\n')
        for file in files:
            if not file:
                continue

            file = file.strip()
            file = file.replace('%20', ' ')
            if file.startswith('file:///') and os.path.isfile(file[7:]):
                if self.verify_image(file[7:]):
                    try:
                        imageaction.mount(self.interface.get_widget('label_selected_image').get_label(), self.image_storage, self.history_storage, self.history_array, self.interface.get_widget('radiobutton_fuse').get_active())
                    except OSError, (errno, strerror):
                        messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nOS error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
                    except IOError, (errno, strerror):
                        messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nIO error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
                    except:
Example #8
0
 def button_delete_log_clicked(self, data):
     if os.path.exists(globals.mount_log):
         if messagebox.show(self.interface.get_widget('main_window'), _('Are you sure you wish to delete the log?'), gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO) == gtk.RESPONSE_YES:
             try:
                 os.remove(globals.mount_log)
             except IOError, (errno, strerror):
                 log.write(globals.mount_log, _('Error deleting log.\nOS error(%s): %s' % (errno, strerror)))
             except OSError, (errno, strerror):
                 log.write(globals.mount_log, _('Error deleting log.\nOS error(%s): %s' % (errno, strerror)))
             except:
Example #9
0
    def __init__(self, parameter):
        
        # Localization
        locale.setlocale(locale.LC_ALL, '')
        gettext.textdomain(globals.assembly_name)
        gettext.bindtextdomain(globals.assembly_name, globals.locale_directory)

        #Set the Glade file
        self.interface = gtk.glade.XML(globals.application_interface, 'main_window')
        self.create_settings_directory()
        self.create_settings_file()
        log.write(globals.mount_log, _('Application started...'))
        self.set_storage_lists()
        self.set_history_entry()
        self.set_mounted_image_treeview()
        self.set_icons_and_text()
        self.load_mount_history()
        self.load_previously_mounted_images()

        HANDLERS_AND_METHODS = {
            'button_checksum_clicked': self.button_checksum_clicked,
            'button_browse_clicked': self.button_browse_clicked,
            'button_about_clicked': self.button_about_clicked,
            'button_view_log_clicked': self.button_view_log_clicked,
            'button_delete_log_clicked': self.button_delete_log_clicked,
            'button_mount_clicked': self.button_mount_clicked,
            'comboentry_image_key_release': self.comboentry_image_key_release,
            'comboentry_image_changed': self.comboentry_image_changed,
            'treeview_mounted_images_cursor_changed': self.treeview_mounted_images_cursor_changed,
            'button_unmount_clicked': self.button_unmount_clicked,
            'button_burn_clicked': self.button_burn_clicked,
            'treeview_mounted_images_drag_data_recieved': self.treeview_mounted_images_drag_data_recieved,
            'treeview_mounted_images_row_activated': self.treeview_mounted_images_row_activated,
            'destroy': self.destroy}
        self.interface.signal_autoconnect(HANDLERS_AND_METHODS)
        if (parameter != ''):
            try:
                imageaction.mount(parameter, self.image_storage, self.history_storage, self.history_array, self.interface.get_widget('radiobutton_fuse').get_active())
            except OSError, (errno, strerror):
                messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nOS error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
            except IOError, (errno, strerror):
                messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nIO error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
Example #10
0
 def clean_up(self, model, path, iter):
     if messagebox.show(self.interface.get_widget('main_window'), _('%s is still mounted.\nDo you wish to unmount it before exiting?' % (model.get_value(iter, 1))), gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO) == gtk.RESPONSE_YES:
         try:
             imageaction.unmount(model.get_value(iter, 0), model.get_value(iter, 2), self.image_storage, iter, True)
         except:
             log.write(globals.mount_log, _('Error unmounting image.\nUnexpected error: %s' % (sys.exc_info()[0])))
     else: #write the history to file for loading later
         try:
             mount_file = open(globals.mount_list, 'a')
             string = '%s,%s,%s' % (model.get_value(iter, 0), model.get_value(iter, 1), model.get_value(iter, 2))
             mount_file.write('%s\n' % (string))
         except IOError, (errno, strerror):
             log.write(globals.mount_log, _('Error saving unmounted images to file.\nOS error(%s): %s' % (errno, strerror)))
         except:
Example #11
0
 def button_burn_clicked(self, data):
     try:
         imageaction.burn(self.interface.get_widget('label_selected_image').get_label(), self.interface.get_widget('radiobutton_brasero').get_active())
     except:
         messagebox.show(self.interface.get_widget('main_window'), _('Error burning image.\nUnexpected error: %s' % (sys.exc_info()[0])), gtk.MESSAGE_ERROR)
Example #12
0
 def button_mount_clicked(self, data):
     try:
         imageaction.mount(self.interface.get_widget('label_selected_image').get_label(), self.image_storage, self.history_storage, self.history_array, self.interface.get_widget('radiobutton_fuse').get_active())
     except OSError, (errno, strerror):
         messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nOS error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
Example #13
0
 def button_view_log_clicked(self, data):
     if os.path.exists(globals.mount_log):
         subprocess.Popen(['gnome-text-editor', globals.mount_log])
     else:
         messagebox.show(self.interface.get_widget('main_window'), _('%s not found.' % (globals.mount_log)))
Example #14
0
         'treeview_mounted_images_cursor_changed': self.treeview_mounted_images_cursor_changed,
         'button_unmount_clicked': self.button_unmount_clicked,
         'button_burn_clicked': self.button_burn_clicked,
         'treeview_mounted_images_drag_data_recieved': self.treeview_mounted_images_drag_data_recieved,
         'treeview_mounted_images_row_activated': self.treeview_mounted_images_row_activated,
         'destroy': self.destroy}
     self.interface.signal_autoconnect(HANDLERS_AND_METHODS)
     if (parameter != ''):
         try:
             imageaction.mount(parameter, self.image_storage, self.history_storage, self.history_array, self.interface.get_widget('radiobutton_fuse').get_active())
         except OSError, (errno, strerror):
             messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nOS error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
         except IOError, (errno, strerror):
             messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nIO error(%s): %s' % (errno, strerror)), gtk.MESSAGE_ERROR)
         except:
             messagebox.show(self.interface.get_widget('main_window'), _('Error mounting image.\nUnexpected error: %s' % (sys.exc_info()[0])), gtk.MESSAGE_ERROR)
     
 def load_previously_mounted_images(self):
     if os.path.exists(globals.mount_list):
         try:
             file_previous_images = open(globals.mount_list, 'rU')
             previous_image_history = file_previous_images.readlines()
             for line in previous_image_history:
                 previous_image = line.strip().split(',')
                 self.image_storage.append([previous_image[0], previous_image[1], previous_image[2]])
             os.remove(globals.mount_list)
         except IOError, (errno, strerror):
             log.write(globals.mount_log, _('Error loading history.\nOS error(%s): %s' % (errno, strerror)))
         except:
             log.write(globals.mount_log, _('Error loading history.\nUnexpected error: %s' % (sys.exc_info()[0])))
         finally:
Example #15
0
 def on_new():
     print "HELLO"
     messagebox.show("NEW FILE")