def _get_row(self, obj): if isinstance(obj, File): fobj = obj else: fobj = self.__fs.get_file(obj) dispatcher.connect(self.__handle_file_change, sender=fobj) return (fobj,)
def _get_row(self, obj): if isinstance(obj, File): fobj = obj else: fobj = self.__fs.get_file(obj) dispatcher.connect(self.__handle_file_change, sender=fobj) return (fobj, )
def add_cmd_widget(self, cmd): pipeline = cmd.cmd_header.get_pipeline() dispatcher.connect(self.__on_pipeline_state_change, 'state-changed', pipeline) self.__cmd_overview.add_pipeline(pipeline, cmd.odisp) pgnum = self.__cmd_notebook.append_page(cmd) self.__cmd_notebook.set_current_page(pgnum) self.__sync_visible() self.__sync_display() gobject.idle_add(lambda: self.__sync_display())
def __init__(self): super(PrefEditorCombo, self).__init__(model=gtk.ListStore(gobject.TYPE_PYOBJECT)) editors = EditorRegistry.getInstance() self.__hotwire_editor = editors['c5851b9c-2618-4078-8905-13bf76f0a94f'] self.__reload_editors() self.set_row_separator_func(self.__is_row_separator) cell = gtk.CellRendererPixbuf() self.pack_start(cell, expand=False) self.set_cell_data_func(cell, self.__render_editor_icon) cell = hotwidgets.CellRendererText() self.pack_start(cell) self.set_cell_data_func(cell, self.__render_editor_name) dispatcher.connect(self.__reload_editors, sender=editors) self.select_editor_uuid(editors.get_preferred().uuid) self.connect('changed', self.__on_changed)
def add_pipeline(self, pipeline): _logger.debug("adding child %s", pipeline) dispatcher.connect(self.__on_pipeline_state_change, 'state-changed', pipeline) odisp = MultiObjectsDisplay(self.__context, pipeline) cmd = CommandExecutionDisplay(self.__context, pipeline, odisp) cmd.cmd_header.connect('action', self.__handle_cmd_action) cmd.cmd_header.connect('expand-inspector', self.__on_expand_inspector) cmd.show_all() pgnum = self.__cmd_notebook.append_page(cmd) self.__cmd_notebook.set_current_page(pgnum) self.__cmd_overview.add_pipeline(pipeline, odisp) self.__sync_visible() self.__sync_display(pgnum) self.notify('pipeline-count') # Garbage-collect old commands at this point gobject.idle_add(self.__command_gc)
def __init__(self): super(PrefEditorCombo, self).__init__(model=gtk.ListStore(gobject.TYPE_PYOBJECT)) editors = EditorRegistry.getInstance() self.__hotwire_editor = editors['c5851b9c-2618-4078-8905-13bf76f0a94f'] self.__reload_editors() self.set_row_separator_func(self.__is_row_separator) cell = gtk.CellRendererPixbuf() self.pack_start(cell, expand=False) self.set_cell_data_func(cell, self.__render_editor_icon) cell = hotwidgets.CellRendererText() self.pack_start(cell) self.set_cell_data_func(cell, self.__render_editor_name) dispatcher.connect(self.__reload_editors, sender=editors) self.select_editor_uuid(editors.get_preferred().uuid) self.connect('changed', self.__on_changed)
def __execute_internal(self, force_sync, opt_formats=[], assert_all_threaded=False): _logger.debug("Executing %s", self) self.__set_state('executing') meta_idx = 0 for i,cmd in enumerate(self.__components): if assert_all_threaded and not cmd.builtin.threaded: raise ValueError("assert_all_threaded is enabled but trying to execute non-threaded builtin %s" % (cmd.builtin,)) dispatcher.connect(self.__on_cmd_complete, 'complete', cmd) dispatcher.connect(self.__on_cmd_exception, "exception", cmd) # Here we record which commands include metadata, and # pass in the index in the pipeline for them. if cmd.builtin.hasmeta: _logger.debug("connecting to metadata on cmd %s, idx=%s", cmd, meta_idx) dispatcher.connect(self.__on_cmd_metadata, 'metadata', cmd) self.__cmd_metaidx[cmd] = meta_idx meta_idx += 1 prev_opt_formats = [] for cmd in self.__components: if cmd.input: cmd.input.negotiate(prev_opt_formats, cmd.get_input_opt_formats()) prev_opt_formats = cmd.get_output_opt_formats() if cmd.out_redir: prev_opt_formats = [] last = self.__components[-1] if not last.out_redir: last_opt_fmts = last.get_output_opt_formats() else: last_opt_fmts = [] last.output.negotiate(last_opt_fmts, opt_formats) for i,cmd in enumerate(self.__components[:-1]): cmd.execute(force_sync) last.execute(force_sync)
def __execute_internal(self, force_sync, opt_formats=[], assert_all_threaded=False): _logger.debug("Executing %s", self) self.__set_state('executing') meta_idx = 0 for i,cmd in enumerate(self.__components): if assert_all_threaded and not cmd.builtin.threaded: raise ValueError("assert_all_threaded is enabled but trying to execute non-threaded builtin %s" % (cmd.builtin,)) dispatcher.connect(self.__on_cmd_complete, 'complete', cmd) dispatcher.connect(self.__on_cmd_exception, "exception", cmd) # Here we record which commands include metadata, and # pass in the index in the pipeline for them. if cmd.builtin.hasmeta: _logger.debug("connecting to metadata on cmd %s, idx=%s", cmd, meta_idx) dispatcher.connect(self.__on_cmd_metadata, 'metadata', cmd) self.__cmd_metaidx[cmd] = meta_idx meta_idx += 1 prev_opt_formats = [] for cmd in self.__components: if cmd.input: cmd.input.negotiate(prev_opt_formats, cmd.get_input_opt_formats()) prev_opt_formats = cmd.get_output_opt_formats() if cmd.out_redir: prev_opt_formats = [] last = self.__components[-1] if not last.out_redir: last_opt_fmts = last.get_output_opt_formats() else: last_opt_fmts = [] last.output.negotiate(last_opt_fmts, opt_formats) for i,cmd in enumerate(self.__components[:-1]): cmd.execute(force_sync) last.execute(force_sync)
def __init__(self, context, pipeline, odisp, overview_mode=True, **args): super(CommandExecutionHeader, self).__init__(**args) self.__context = context self.__pipeline = pipeline self.__overview_mode = overview_mode self.__primary_complete = False self.__complete_unseen = False self.__last_view_time = None self.__visible = True self.__prev_pipeline_state = None self.__cancelled = False self.__undone = False self.__exception = False self.__mouse_hovering = False self.__throbber_pixbuf_done = PixbufCache.getInstance().get('throbber-done.gif', size=None) self.__throbber_pixbuf_ani = PixbufCache.getInstance().get('throbber.gif', size=None, animation=True) self.__tooltips = gtk.Tooltips() dispatcher.connect(self.__on_pipeline_state_change, 'state-changed', self.__pipeline) dispatcher.connect(self.__on_pipeline_metadata, 'metadata', self.__pipeline) self.__main_hbox = gtk.HBox() self.pack_start(self.__main_hbox, expand=True) self.__cmdstatus_vbox = gtk.VBox() self.__main_hbox.pack_start(self.__cmdstatus_vbox, expand=True) self.__titlebox_ebox = gtk.EventBox() self.__titlebox_ebox.set_visible_window(False) if overview_mode: self.__titlebox_ebox.add_events(gtk.gdk.BUTTON_PRESS_MASK & gtk.gdk.ENTER_NOTIFY_MASK & gtk.gdk.LEAVE_NOTIFY_MASK) self.__titlebox_ebox.connect("enter_notify_event", self.__on_enter) self.__titlebox_ebox.connect("leave_notify_event", self.__on_leave) self.__titlebox_ebox.connect("button-press-event", lambda eb, e: self.__on_button_press(e)) self.__titlebox = gtk.HBox() self.__titlebox_ebox.add(self.__titlebox) self.__cmdstatus_vbox.pack_start(hotwidgets.Align(self.__titlebox_ebox), expand=False) self.__pipeline_str = self.__pipeline.__str__() self.__title = gtk.Label() self.__title.set_alignment(0, 0.5) #self.__title.set_selectable(True) self.__title.set_ellipsize(True) self.__state_image = gtk.Image() self.__titlebox.pack_start(self.__state_image, expand=False) self.__titlebox.pack_start(hotwidgets.Align(self.__title, padding_left=4), expand=True) self.__statusbox = gtk.HBox() self.__cmdstatus_vbox.pack_start(self.__statusbox, expand=False) self.__status_left = gtk.Label() self.__status_right = gtk.Label() self.__statusbox.pack_start(hotwidgets.Align(self.__status_left, padding_left=4), expand=False) self.__action = hotwidgets.Link() self.__action.connect("clicked", self.__on_action) self.__statusbox.pack_start(hotwidgets.Align(self.__action), expand=False) self.__statusbox.pack_start(hotwidgets.Align(self.__status_right), expand=False) self.__undoable = self.__pipeline.get_undoable() and (not self.__pipeline.get_idempotent()) status_cmds = list(pipeline.get_status_commands()) self.__pipeline_status_visible = False if status_cmds: self.__cmd_statuses = gtk.HBox(spacing=8) show_cmd_name = len(status_cmds) > 1 for cmdname in status_cmds: self.__cmd_statuses.pack_start(CommandStatusDisplay(show_cmd_name and cmdname or None), expand=True) self.__statusbox.pack_start(hotwidgets.Align(self.__cmd_statuses), expand=False) else: self.__cmd_statuses = None self.__cmd_status_show_cmd = False self.__objects = odisp self.__objects.connect("primary-complete", self.__on_primary_complete) self.__objects.connect("changed", lambda o: self.__update_titlebox()) self.__exception_box = gtk.HBox() self.__exception_link = hotwidgets.Link() self.__exception_link.set_alignment(0.0, 0.5) self.__exception_link.set_ellipsize(True) self.__exception_link.connect('clicked', self.__on_exception_clicked) self.__exception_box.pack_start(self.__exception_link, expand=True) self.__cmdstatus_vbox.pack_start(hotwidgets.Align(self.__exception_box, padding_left=4), expand=False) if overview_mode: self.__cmdstatus_vbox.pack_start(gtk.HSeparator(), expand=False) self.__otype_expander = None else: self.__otype_expander = gtk.Expander('') self.__otype_expander.unset_flags(gtk.CAN_FOCUS); self.__otype_expander.set_use_markup(True) self.__otype_expander.connect('notify::expanded', self.__on_otype_expander_toggled) self.__main_hbox.pack_start(self.__otype_expander, expand=False)