def __init__ (self):
        # Model
        self.scripts_liststore = gtk.ListStore \
            (gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)

        self.scripts_list = ScriptsList (get_root()+"/conf/scripts.list")
        self.scripts_list.update ()

        for entry in self.scripts_list.items():
            if not entry.has_key ("selected"):
                entry['selected'] = False
            self.scripts_liststore.append((entry['selected'], entry['name'], entry))

        # View
        self.window = gtk.Window ()
        self.window.set_title ("scripts.list editor")
        self.window.set_size_request (400, 400)

        self.scroll = gtk.ScrolledWindow ()
        self.scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)

        self.treeview = gtk.TreeView ()
        self.vbox = gtk.VBox (False, 10)

        self.ok_button = gtk.Button ("OK")
        self.ok_button.connect ("clicked", self.on_press_ok, None)

        self.scroll.add (self.treeview)
        self.vbox.pack_start (self.scroll, True, True, 0)
        self.vbox.pack_start (self.ok_button, False, False, 0)
        self.window.add (self.vbox)

        # first column
        render = gtk.CellRendererToggle ()
        render.set_property ('activatable', True)
        render.set_property ('width', 20)
        render.connect ('toggled', self.on_toggled, self.scripts_liststore)
        col = gtk.TreeViewColumn ()
        col.pack_start (render)
        col.set_attributes (render, active=0)
        self.treeview.append_column (col)

        # second column
        col = gtk.TreeViewColumn ("items")
        render=gtk.CellRendererText ()
        col.pack_start (render)
        col.set_attributes (render, markup=1)
        self.treeview.append_column (col)

        self.treeview.set_model (self.scripts_liststore)

        self.treeview.show ()
        self.scroll.show ()
        self.window.show_all ()

        # Controller
        self.window.connect ("destroy", gtk.main_quit)
Exemple #2
0
    def load_tree(self, list_store, scripts_list_file):
        loc = locale.getlocale (locale.LC_ALL)
        lzs_loc = ""
        if (loc[0] == None):
            lzs_loc = "enUS"
        else:
            lzs_loc = loc[0].replace ("_", "")

        scripts_list = ScriptsList(scripts_list_file)
        scripts_list.update()
        script_set = ScriptSet.from_scriptslist(scripts_list)
        for category in script_set.categories():
            category.lang = lzs_loc
            tool_page = ToolPage()
            tool_page.title = category.name
            tool_page.img = category._icon_name

            for script in category.items():
                tool = Tool (script, script.selected)
                tool_page.tools.append(tool)

            tool_page.get_widget()
            list_store.append( (tool_page.img, tool_page.title, tool_page) )
            self.all_tools.append(tool_page)
Exemple #3
0
 def download_scripts (self, lock):
     scripts_list = ScriptsList.get_by_detect()
     scripts_list.update()
     self.script_set = ScriptSet.from_scriptslist(scripts_list)
     lock.release ()
def test_from_repo():
	"test to create a source list from a git repositry."
	list = ScriptsList.from_repo(remote_repo, get_repodir())
	list.path = get_datadir()+'/scripts.list'
	list.save()
def test_get_by_distro():
    list = ScriptsList.get_by_detect(True)
    list.update()
    assert len(list.items()) != 0
def _test_from_repo():
	"test to create a source list from a git repositry."
	list = ScriptsList.from_repo(get_datadir()+'scriptspoll/7796c33a9348485b055f671c686568b0/')
	list.path = get_datadir()+'/scripts.list'
	list.save()