Exemple #1
0
 def __init__ (self, app_data, uimanager):
     GObject.GObject.__init__ (self)
     IdleHelper.__init__(self)
     self.app_data = app_data
     
     builder = Gtk.Builder()
     builder.add_from_file(os.path.join(DATA_DIR, 'projects.ui'))
     builder.connect_signals(self)
     
     self.widget = builder.get_object('widget_projects')
     self.treeview_open = builder.get_object('treeview_open_projects')
     self.treeview_open.connect('button_press_event', self.on_treeview_projects_button_press_event)
     self.treeview_open.connect('row-activated', self.on_treeview_projects_row_activated)
     self.treeview = builder.get_object('treeview_projects')
     self.treeview.connect('button_press_event', self.on_treeview_projects_button_press_event)
     self.treeview.connect('row-activated', self.on_treeview_projects_row_activated)
     self.actiongroup_widget = builder.get_object('ProjectsPluginWidgetActions')
     self.actiongroup_active = builder.get_object('ProjectsPluginActiveActions')
     
     self.uimanager = uimanager
     self.uimanager.insert_action_group(self.actiongroup_widget, 0)
     self.uimanager.insert_action_group(self.actiongroup_active, 1)
     menu_file = os.path.join(DATA_DIR, 'menu.ui')
     self.merge_id = self.uimanager.add_ui_from_file(menu_file)
     self.menuitem_default_merge_id = self.uimanager.new_merge_id()
     self.menu_project = self.uimanager.get_widget('/projects_panel_popup')
     self.menu_project.attach_to_widget(self.treeview, None)
     
     self.treeview_open.set_model(self.app_data.sort_model_open)
     self.treeview.set_model(self.app_data.sort_model)
Exemple #2
0
 def __init__(self):
     GObject.GObject.__init__ (self)
     IdleHelper.__init__(self)
     
     self.config = ConfigHelper()
     #   projectname, projectpath, pangoweight, sort-path, projectpath
     self.model_open = Gtk.ListStore(str, str, int, str, str)
     self.sort_model_open = self.model_open.sort_new_with_model()
     self.sort_model_open.set_sort_column_id(3, Gtk.SortType.ASCENDING)
     self.model = Gtk.TreeStore(str, str, int, str, str)
     self.sort_model = self.model.sort_new_with_model()
     self.sort_model.set_sort_column_id(3, Gtk.SortType.ASCENDING)
     self.known_projects = {} # key: project path, value: inserted (bool)
     self.active_project = None # filename
     self.scan_queue = None # if not None scan for projects is in progress
     self.insert_queue = None # if not None insert projects to model is in progress
     
     self.config.connect('find-projects', lambda unused: self.do_scan_projects())
     
     self._project_ind = self.config.project_indications.split()
     self._project_ind_ns = self.config.project_indications_ns.split()
     if self.config.scan_on_start:
         self.do_scan_projects()
     else:
         self.known_projects = {p: False for p in self.config.get_projects()}
         self.do_insert_known_projects()
Exemple #3
0
 def __init__(self):
     GObject.Object.__init__(self)
     IdleHelper.__init__(self)
     self.panel_helper = None
     self.handlers = []
     self.uimanager = None
     self.recent_merge_id = None
     self.actiongroup_recent = None
Exemple #4
0
 def deactivate(self):
     IdleHelper.deactivate(self)
     self._project_ind_ns = []
     self._project_ind = []
     self.scan_queue = None
     self.insert_queue = None
     self.active_project = None
     self.known_projects.clear()
     self.config.deactivate()
     self.config = None
Exemple #5
0
 def deactivate(self):
     IdleHelper.deactivate(self)
     self.uimanager.remove_ui(self.menuitem_default_merge_id)
     self.uimanager.remove_ui(self.merge_id)
     self.uimanager.remove_action_group(self.actiongroup_widget)
     self.uimanager.remove_action_group(self.actiongroup_active)
     
     self.menu_project = None
     self.treeview_open = None
     self.treeview = None
     self.widget = None
     self.app_data = None
Exemple #6
0
 def do_deactivate(self):
     IdleHelper.deactivate(self)
     self._disconnect_all()
     if self.app_data is None:
         return
     
     self.uimanager.remove_ui(self.recent_merge_id)
     self.uimanager.remove_action_group(self.actiongroup_recent)
     self.actiongroup_recent = None
     panel = self.window.get_side_panel()
     panel.remove_item(self.panel_helper.widget)
     self.panel_helper.deactivate()
     self.panel_helper = None
     
     if len(Gedit.App.get_default().get_windows()) <= 1:
         self.app_data.deactivate()
         self.__class__.app_data = None