def _createUi(self, instance): """ Create the graphical interface """ self.set_title("%s" % (APPNAME)) self.connect("delete-event", self._deleteCb) self.connect("configure-event", self._configureCb) # main menu & toolbar vbox = gtk.VBox(False) self.add(vbox) vbox.show() self.menu = self.uimanager.get_widget("/MainMenuBar") vbox.pack_start(self.menu, expand=False) self.menu.show() self.toolbar = self.uimanager.get_widget("/MainToolBar") vbox.pack_start(self.toolbar, expand=False) self.toolbar.show() # timeline and project tabs vpaned = gtk.VPaned() vbox.pack_start(vpaned) vpaned.show() self.timeline = Timeline(instance, self.uimanager) self.timeline.project = self.project vpaned.pack2(self.timeline, resize=True, shrink=False) self.timeline.show() self.mainhpaned = gtk.HPaned() vpaned.pack1(self.mainhpaned, resize=True, shrink=False) self.secondhpaned = gtk.HPaned() self.mainhpaned.pack1(self.secondhpaned, resize=True, shrink=False) self.secondhpaned.show() self.mainhpaned.show() self.projecttabs = BaseTabs(instance) self.sourcelist = SourceList(instance, self.uimanager) self.projecttabs.append_page(self.sourcelist, gtk.Label(_("Media Library"))) self._connectToSourceList() self.sourcelist.show() self.effectlist = EffectList(instance, self.uimanager) self.projecttabs.append_page(self.effectlist, gtk.Label(_("Effect Library"))) self.effectlist.show() self.secondhpaned.pack1(self.projecttabs, resize=True, shrink=False) self.projecttabs.show() #Clips properties self.propertiestabs = BaseTabs(instance, True) self.clipconfig = ClipProperties(instance, self.uimanager) self.clipconfig.project = self.project self.propertiestabs.append_page(self.clipconfig, gtk.Label(_("Effects configurations"))) self.clipconfig.show() self.secondhpaned.pack2(self.propertiestabs, resize= True, shrink=False) self.propertiestabs.show() # Viewer self.viewer = PitiviViewer() # drag and drop self.viewer.drag_dest_set(gtk.DEST_DEFAULT_DROP | gtk.DEST_DEFAULT_MOTION, [dnd.FILESOURCE_TUPLE, dnd.URI_TUPLE], gtk.gdk.ACTION_COPY) self.viewer.connect("drag_data_received", self._viewerDndDataReceivedCb) self.mainhpaned.pack2(self.viewer, resize=False, shrink=False) self.viewer.show() self.viewer.connect("expose-event", self._exposeEventCb) # window and pane position defaults self.mainhpaned = self.mainhpaned self.hpaned = self.secondhpaned self.vpaned = vpaned height = -1 width = -1 if self.settings.mainWindowHPanePosition: self.hpaned.set_position(self.settings.mainWindowHPanePosition) if self.settings.mainWindowMainHPanePosition: self.mainhpaned.set_position(self.settings.mainWindowMainHPanePosition) if self.settings.mainWindowVPanePosition: self.vpaned.set_position(self.settings.mainWindowVPanePosition) if self.settings.mainWindowWidth: width = self.settings.mainWindowWidth if self.settings.mainWindowHeight: height = self.settings.mainWindowHeight self.set_default_size(width, height) if height == -1 and width == -1: self.maximize() self._do_pending_fullscreen = False # FIXME: don't know why this doesn't work #if self.settings.mainWindowFullScreen: # self._do_pending_fullscreen = True # timeline toolbar # FIXME: remove toolbar padding and shadow. In fullscreen mode, the # toolbar buttons should be clickable with the mouse cursor at the # very bottom of the screen. ttb = self.uimanager.get_widget("/TimelineToolBar") vbox.pack_start(ttb, expand=False) ttb.show() self.show() if not self.settings.mainWindowShowMainToolbar: self.toolbar.props.visible = False if not self.settings.mainWindowShowTimelineToolbar: ttb.props.visible = False #application icon self.set_icon_name("pitivi") #pulseaudio 'role' (http://0pointer.de/blog/projects/tagging-audio.htm os.environ["PULSE_PROP_media.role"] = "production" os.environ["PULSE_PROP_application.icon_name"] = "pitivi"
def run(self, argv): # check for dependencies if not self._checkDependencies(): return # parse cmdline options parser = self._createOptionParser() options, args = parser.parse_args(argv) # if we aren't importing sources then n_args should be at most # 1 + parameters that take individual arguments n_args = 1 if options.debug: sys.excepthook = self._excepthook # validate options self.render_output = options.render_output self.preview = options.preview if options.render_output: options.no_ui = True n_args += 1 if options.render_output and options.preview: parser.error("-p and -r cannot be used simultaneously") return if options.import_sources and (options.render_output or options.preview): parser.error("-r or -p and -i are incompatible") return if not options.import_sources and options.add_to_timeline: parser.error("-a requires -i") return if not options.import_sources and ((options.render_output and len(args) != 2) or len(args) > n_args): parser.error("invalid arguments") return if options.no_ui: self.gui = None elif options.preview: # init ui for previewing self.gui = PitiviViewer() self.window = gtk.Window() self.window.connect("delete-event", self._deleteCb) self.window.add(self.gui) self.window.show_all() else: # create the ui self.gui = PitiviMainWindow(self) self.gui.show() if not options.import_sources and args: index = 0 if options.render_output: self.output_file = "file://%s" % os.path.abspath(args[index]) index += 1 # load a project file project = "file://%s" % os.path.abspath(args[index]) self.projectManager.loadProject(project) else: # load the passed filenames, optionally adding them to the timeline # (useful during development) self.projectManager.newBlankProject() uris = ["file://" + urllib.quote(os.path.abspath(path)) for path in args] self.current.sources.connect("source-added", self._sourceAddedCb, uris, options.add_to_timeline) self.current.sources.connect("discovery-error", self._discoveryErrorCb, uris) self.current.sources.addUris(uris) # run the mainloop self.mainloop.run()
def _createUi(self, instance): """ Create the graphical interface """ self.set_title("%s v%s" % (APPNAME, pitivi_version)) self.connect("delete-event", self._deleteCb) self.connect("configure-event", self._configureCb) # main menu & toolbar vbox = gtk.VBox(False) self.add(vbox) self.menu = self.uimanager.get_widget("/MainMenuBar") vbox.pack_start(self.menu, expand=False) self.toolbar = self.uimanager.get_widget("/MainToolBar") vbox.pack_start(self.toolbar, expand=False) # timeline and project tabs vpaned = gtk.VPaned() vbox.pack_start(vpaned) self.timeline = Timeline(instance, self.uimanager) self.timeline.project = self.project vpaned.pack2(self.timeline, resize=False, shrink=False) hpaned = gtk.HPaned() vpaned.pack1(hpaned, resize=True, shrink=False) self.projecttabs = ProjectTabs() self.sourcelist = SourceList(instance, self.uimanager) self.projecttabs.append_page(self.sourcelist, gtk.Label(_("Clip Library"))) self._connectToSourceList() hpaned.pack1(self.projecttabs, resize=True, shrink=False) self.timeline.ruler.connect('seek', self._timelineRulerSeekCb) # Viewer self.viewer = PitiviViewer() # drag and drop self.viewer.drag_dest_set( gtk.DEST_DEFAULT_DROP | gtk.DEST_DEFAULT_MOTION, [dnd.FILESOURCE_TUPLE, dnd.URI_TUPLE], gtk.gdk.ACTION_COPY) self.viewer.connect("drag_data_received", self._viewerDndDataReceivedCb) hpaned.pack2(self.viewer, resize=False, shrink=False) self.viewer.connect("expose-event", self._exposeEventCb) # window and pane position defaults self.hpaned = hpaned self.vpaned = vpaned height = -1 width = -1 if self.settings.mainWindowHPanePosition: self.hpaned.set_position(self.settings.mainWindowHPanePosition) if self.settings.mainWindowVPanePosition: self.vpaned.set_position(self.settings.mainWindowVPanePosition) if self.settings.mainWindowWidth: width = self.settings.mainWindowWidth if self.settings.mainWindowHeight: height = self.settings.mainWindowHeight self.set_default_size(width, height) if height == -1 and width == -1: self.maximize() self._do_pending_fullscreen = False # FIXME: don't know why this doesn't work #if self.settings.mainWindowFullScreen: # self._do_pending_fullscreen = True # timeline toolbar # FIXME: remove toolbar padding and shadow. In fullscreen mode, the # toolbar buttons should be clickable with the mouse cursor at the # very bottom of the screen. ttb = self.uimanager.get_widget("/TimelineToolBar") vbox.pack_start(ttb, expand=False) self.show_all() if not self.settings.mainWindowShowMainToolbar: self.toolbar.props.visible = False if not self.settings.mainWindowShowTimelineToolbar: ttb.props.visible = False #application icon self.set_icon_name("pitivi")
def _createGui(self): self.viewer = PitiviViewer(self) window = gtk.Window() window.connect("delete-event", self._deleteCb) window.add(self.viewer) return window