Ejemplo n.º 1
0
 def __init__(self):
     """
     Constructor.
     """
     self.id= 0
     self.current_action = None
     # init glade interface
     logging.debug('initializing glade interface')
     self.glade = gtk.glade.XML(
         os.path.join(
             settings.get_resource_dir(), 'glade', '%s.glade' % APP_NAME
         )
     )
     # connect signals
     logging.debug('connecting signals')
     sigs = {
         'on_button_search_clicked': self.on_search_action,
         'on_file_new_workflow_activate': self.on_new_workflow,
         'on_file_open_workflow_activate': self.on_open_workflow,
         'on_file_save_workflow_activate': self.on_save_workflow,
         'on_button_play_workflow_clicked': self.on_play_workflow,
         'on_button_stop_workflow_clicked': self.on_stop_workflow,
         'on_help_about_activate': self.on_open_about,
         'on_file_quit_activate': self.on_quit,
         'on_window_resize': self.on_window_resize,
         'on_window_destroy': self.on_quit
     }
     self.glade.signal_autoconnect(sigs)
     # widgets
     logging.debug('loading widgets')
     self.window = self.glade.get_widget('window_main')
     self.layout_actions = self.glade.get_widget('layout_actions')
     self.label_action_name = self.glade.get_widget('label_action_name')
     self.label_action_desc = self.glade.get_widget('label_action_desc')
     self.image_action_icon = self.glade.get_widget('image_action_icon')
     self.button_search = self.glade.get_widget('button_search')
     self.hpaned = self.glade.get_widget('hpaned1')
     self.tv_categories = self.init_categories_treeview()
     self.tv_actions = self.init_actions_treeview()
     self.tv_workflow = self.init_workflow_treeview()
     # set up drag and drop
     self.dnd_src = [('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_APP, 0)]
     self.tv_actions.enable_model_drag_source(
         gtk.gdk.BUTTON1_MASK, self.dnd_src, gtk.gdk.ACTION_COPY)
     self.tv_workflow.enable_model_drag_source(
         gtk.gdk.BUTTON1_MASK, self.dnd_src, gtk.gdk.ACTION_MOVE)
     self.tv_actions.connect("drag_begin", self.on_drag_begin)
     self.tv_workflow.connect("drag_begin", self.on_drag_begin)
     self.tv_workflow.enable_model_drag_dest(
         self.dnd_src+[('text/plain', 0, 1)],
         gtk.gdk.ACTION_COPY)
     self.tv_workflow.connect(
         "drag_data_received",
         self.on_drag_data_received
     )
     self.tv_workflow.connect('drag-motion', self.on_drag_motion)
Ejemplo n.º 2
0
 def on_workflow_action_activated(self, tv, path, tv_col):
     """
     Callback called when the user has selected an action in the treeview.
     """
     logging.debug('entering method MainWindow::on_workflow_action_activated()')
     xml = gtk.glade.XML(os.path.join(
         settings.get_resource_dir(), 'glade', 'action.glade'
     ))
     dialog = xml.get_widget('dialog_action')
     dialog.show()