=== modified file 'openshot/classes/track.py' --- openshot/classes/track.py 2010-07-06 03:23:04 +0000 +++ openshot/classes/track.py 2011-08-05 08:49:50 +0000 @@ -58,7 +58,7 @@ # Adjust default length of images (all images default to 300 seconds.. i.e. 5 minutes) # But since nobody wants an image to default to 5 minutes long, we adjust it to the default image length. - if NewClip.length() == 300.0: + if NewClip.file_object.file_type == "image": from windows import preferences NewClip.end_time = NewClip.start_time + float(preferences.Settings.general["imported_image_length"])#7.0 @@ -248,32 +248,35 @@ def on_visible_click (self, item, target, event): - # get a reference to the language translate method - _ = self.parent.project.translate - - # get the parent left group - parent_group = item.get_parent() - - if self.play_video == True: - # Load Hover Over - imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/not_visible.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) - imgTrack_Left_Hover.set_tooltip_text(_("Video not Visible")) - item.set_properties(widget = imgTrack_Left_Hover) - - # update play video variable - self.play_video = False - - else: - # Load normal image - imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/visible.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) - imgTrack_Left_Hover.set_tooltip_text(_("Video Visible")) - item.set_properties(widget = imgTrack_Left_Hover) - - # update play video variable - self.play_video = True - - # mark project as modified - self.parent.project.set_project_modified(is_modified=True, refresh_xml=True, type=_("Changed visibility of track")) + # left click + if event.button == 1: + + # get a reference to the language translate method + _ = self.parent.project.translate + + # get the parent left group + parent_group = item.get_parent() + + if self.play_video == True: + # Load Hover Over + imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/not_visible.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) + imgTrack_Left_Hover.set_tooltip_text(_("Video not Visible")) + item.set_properties(widget = imgTrack_Left_Hover) + + # update play video variable + self.play_video = False + + else: + # Load normal image + imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/visible.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) + imgTrack_Left_Hover.set_tooltip_text(_("Video Visible")) + item.set_properties(widget = imgTrack_Left_Hover) + + # update play video variable + self.play_video = True + + # mark project as modified + self.parent.project.set_project_modified(is_modified=True, refresh_xml=True, type=_("Changed visibility of track")) return False @@ -281,32 +284,35 @@ def on_audio_click (self, item, target, event): - # get a reference to the language translate method - _ = self.parent.project.translate - - # get the parent left group - parent_group = item.get_parent() - - if self.play_audio == True: - # Load Hover Over - imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/speaker_mute.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) - imgTrack_Left_Hover.set_tooltip_text(_("Sound Deactivated")) - item.set_properties(widget = imgTrack_Left_Hover) - - # update play audio variable - self.play_audio = False - - else: - # Load normal image - imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/speaker.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) - imgTrack_Left_Hover.set_tooltip_text(_("Sound Activated")) - item.set_properties(widget = imgTrack_Left_Hover) - - # update play audio variable - self.play_audio = True - - # mark project as modified - self.parent.project.set_project_modified(is_modified=True, refresh_xml=True, type=_("Changed audio of track")) + # left click + if event.button == 1: + + # get a reference to the language translate method + _ = self.parent.project.translate + + # get the parent left group + parent_group = item.get_parent() + + if self.play_audio == True: + # Load Hover Over + imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/speaker_mute.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) + imgTrack_Left_Hover.set_tooltip_text(_("Sound Deactivated")) + item.set_properties(widget = imgTrack_Left_Hover) + + # update play audio variable + self.play_audio = False + + else: + # Load normal image + imgTrack_Left_Hover = gtk.image_new_from_file("%s/openshot/themes/%s/speaker.png" % (self.parent.project.form.openshot_path, self.parent.project.theme)) + imgTrack_Left_Hover.set_tooltip_text(_("Sound Activated")) + item.set_properties(widget = imgTrack_Left_Hover) + + # update play audio variable + self.play_audio = True + + # mark project as modified + self.parent.project.set_project_modified(is_modified=True, refresh_xml=True, type=_("Changed audio of track")) return False @@ -359,4 +365,4 @@ elif MyClip1.position_on_track == MyClip2.position_on_track: return 0 else: - return -1 \ No newline at end of file + return -1 === modified file 'openshot/windows/MainGTK.py' --- openshot/windows/MainGTK.py 2011-03-07 04:29:13 +0000 +++ openshot/windows/MainGTK.py 2011-08-05 12:38:26 +0000 @@ -2549,34 +2549,70 @@ self.MyCanvas.scroll_to(horizontal_value, vertical_value) self.MyCanvas_Left.scroll_to(horizontal_value, vertical_value) - def on_treeFiles_button_press_event(self,treeview, event, *args): + def on_treeFiles_button_press_event(self, treeview, event, *args): """This shows the right click menu""" - #print "on_treeFiles_button_press_event" + # Right click if (event.button == 3): - # determine which item the user right clicked on - # path, treecolumn, mouse_x, mouse_y = treeview.get_path_at_pos(int(event.x),int(event.y)) - # treeview.row_activated(path, treecolumn) - + results = treeview.get_path_at_pos(int(event.x),int(event.y)) # Get the selection selection = treeview.get_selection() - # Get the selected path(s) - rows, selected = selection.get_selected_rows() - - mnu = mnuTree(rows, selected, form=self, project=self.project) + + # if an item was right clicked + if results: + + # Get the path to the right clicked item + path = results[0] + + # if the item wasn't selected, unselect all items + if not selection.path_is_selected(path): + selection.unselect_all() + + # Select the clicked item + selection.select_path(path) + + # Get the model and paths of the selected items + model, paths = selection.get_selected_rows() + + # Item menu + mnu = mnuTree(model, paths, form=self, project=self.project) + + else: + # Basic menu + mnu = mnuTree(None, None, form=self, project=self.project) + + # Display the menu mnu.showmnu(event, treeview) - + return True def on_icvFileIcons_button_press_event(self, widget, event, *args): """This shows the right click menu""" - + + # Right click if (event.button == 3): - #iconview is active - selected = self.icvFileIcons.get_selected_items() - - #show the right click menu - mnu = mnuTree(None, selected, form=self, project=self.project) + # Get the path to the right clicked item + path = self.icvFileIcons.get_path_at_pos(int(event.x),int(event.y)) + + # if an item was right clicked + if path: + # if the item wasn't selected, unselect all items + if not self.icvFileIcons.path_is_selected(path): + self.icvFileIcons.unselect_all() + + # Select the clicked item + self.icvFileIcons.select_path(path) + + # Get a list of the paths of all selected items + paths = self.icvFileIcons.get_selected_items() + + # Item menu + mnu = mnuTree(None, paths, form=self, project=self.project) + else: + # Basic menu + mnu = mnuTree(None, None, form=self, project=self.project) + + # Show the right click menu mnu.showmnu(event, widget)