def __init__(self, app, category, status, model, showboth): control.__init__() self.app = app self.category = category self.status = status self.model = model self.sortkey = 0 self.showboth = showboth
def refresh_system_call(self): '''Call the refresh of the app''' apt_pkg.init() self.cache = apt_pkg.Cache() if self.action_group is not None: self.action_group.release() self.depcache = apt_pkg.DepCache(self.cache) self.action_group = apt_pkg.ActionGroup(self.depcache) control.__init__() self.aid = control.controller.app_install_directory self.marked_as_install = [] self.theme = Gtk.IconTheme.get_default() self.theme.append_search_path("/usr/share/app-install/icons/") self.current_apps_model = self.ui.apps_all.model self.current_installed_model = self.ui.apps_installed.model self.refresh_app_basket() self.ui.apps_all.set_model(self.ui.apps_all.model) self.ui.apps_installed.set_model(self.ui.apps_installed.model) self.ui.apps_message.set_visible(False) self.ui.installed_message.set_visible(False) if self.ui.toolbar.__class__.__name__ == "Toolbar": self.ui.toolbar.set_style(3) self.packages = [] if (not self.startup) and (self.ui.pages.get_page() in [1, 2]): if self.ui.pages.get_page() == 1: self.get_func() if self.choosed_category == "fonts": showboth = True else: showboth = False self.append_packages_call(self.choosed_category, [], self.ui.apps_all.model, showboth) if self.ui.pages.get_page() == 2: self.installed_func() elif self.startup: self.back_home(None) if control.controller.check_internet: self.check_internet() self.startup = False
def refresh_system_call(self): '''Call the refresh of the app''' apt_pkg.init() self.cache = apt_pkg.Cache() if self.action_group is not None: self.action_group.release() self.depcache = apt_pkg.DepCache(self.cache) self.action_group = apt_pkg.ActionGroup(self.depcache) control.__init__() self.aid = control.controller.app_install_directory self.marked_as_install = [] self.theme = Gtk.IconTheme.get_default() self.theme.append_search_path("/usr/share/app-install/icons/") self.current_apps_model = self.ui.apps_all.model self.current_installed_model = self.ui.apps_installed.model self.refresh_app_basket() self.ui.apps_all.set_model(self.ui.apps_all.model) self.ui.apps_installed.set_model(self.ui.apps_installed.model) self.ui.apps_message.set_visible(False) self.ui.installed_message.set_visible(False) self.ui.toolbar.set_style(3) self.packages = [] if (not self.startup) and (self.ui.pages.get_page() in [1, 2]): if self.ui.pages.get_page() == 1: self.get_func() if self.choosed_category == "fonts": showboth = True else: showboth = False self.append_packages_call(self.choosed_category, [], self.ui.apps_all.model, showboth) if self.ui.pages.get_page() == 2: self.installed_func() elif self.startup: self.back_home(None) if control.controller.check_internet: self.check_internet() self.startup = False
from ConfigParser import RawConfigParser from notify import notify import control import os from aptdaemon import client, gtk3widgets from . import LOG import gettext _ = gettext.gettext client = client.AptClient() dialog = gtk3widgets.AptProgressDialog(debconf=True) control.__init__() import sqlite3 db_path = os.path.join(control.controller.db_path, "lsc_packages.db") try: db = sqlite3.Connection(db_path) cursor = db.cursor() except sqlite3.OperationalError: result = os.system('gksu -m %s xenta-software-center-build-db %s %s \ /usr/share/LSC/categories.ini' % ( _('"The database for Xenta Software Center needs to be (re-)created"'), db_path, control.controller.app_install_directory)) if result == 0: db = sqlite3.Connection(db_path) cursor = db.cursor() else:
def __init__(self, app): super(Preferences_UI, self).__init__() control.__init__() self.set_size_request(400, -1) self.set_resizable(False) self.set_icon_name("gtk-preferences") self.connect("destroy", self.hide_window) self.set_position(Gtk.WindowPosition.CENTER) self.set_title(_("Lubuntu Software Center Preferences")) self.box = Gtk.VBox() self.box.set_spacing(5) self.box.set_border_width(5) self.bbox = Gtk.HBox() self.bbox.set_spacing(5) self.bbox2 = Gtk.HButtonBox() self.bbox2.set_spacing(5) self.bbox2.set_layout(Gtk.ButtonBoxStyle.END) self.app = app self.combo = Gtk.Switch() self.toggle = Gtk.Switch() self.scrot = Gtk.Switch() self.internet = Gtk.Switch() self.cancel = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL) self.cancel.connect("clicked", self.hide_window) self.apply = Gtk.Button.new_from_stock(Gtk.STOCK_APPLY) self.apply.connect("clicked", self.apply_preferences) self.software_source = Gtk.Button(_("Open Software Properties")) self.software_source.connect("clicked", self.app.open_software_properties) self.about = Gtk.Button.new_from_stock(Gtk.STOCK_ABOUT) self.about.connect("clicked", self.app.on_show_about) self.refresh_func = None self.combo.set_active(control.controller.expert_mode) self.toggle.set_active(control.controller.render_icons) self.scrot.set_active(control.controller.show_scrot) self.internet.set_active(control.controller.check_internet) self.bbox2.pack_start(self.apply, False, False, 0) self.bbox2.pack_start(self.cancel, False, False, 0) self.bbox.pack_start(self.software_source, False, False, 0) self.bbox.pack_end(self.about, False, False, 0) #---------------------------------------------- lab = Gtk.Label("<b>" + _("General") + "</b>") lab.props.xalign = 0.0 lab.set_use_markup(True) self.box.pack_start(lab, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Expert Mode")), False, False, 0) self.box2.pack_end(self.combo, False, False, 0) self.box.pack_start(self.box2, False, False, 0) lab = Gtk.Label("<b>" + _("Performance") + "</b>") lab.props.xalign = 0.0 lab.set_use_markup(True) self.box.pack_start(lab, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Render Icons")), False, False, 0) self.box2.pack_end(self.toggle, False, False, 0) self.box.pack_start(self.box2, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Download Screenshots")), False, False, 0) self.box2.pack_end(self.scrot, False, False, 0) self.box.pack_start(self.box2, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Check connection at startup")), False, False, 0) self.box2.pack_end(self.internet, False, False, 0) self.box.pack_start(self.box2, False, False, 0) #---------------------------------------------- self.box.pack_start(self.bbox, False, False, 0) self.box.pack_start(self.bbox2, False, False, 0) self.add(self.box)
def __init__(self, categories_func, categories_dict): '''Setting up the UI''' super(Gui, self).__init__() self.set_position(Gtk.WindowPosition.CENTER) self.set_title(_("Xenta Software Center")) self.set_icon_name("xenta-software-center") self.set_default_size(750, 400) self.connect("destroy", self.close_app) control.__init__() self.cssstyle = """ GtkViewport#lscviewport { background-color: @base_color; } """ self.screen = Gdk.Screen.get_default() self.providestyle = Gtk.CssProvider() self.providestyle.load_from_data(self.cssstyle) Gtk.StyleContext.add_provider_for_screen(self.screen, self.providestyle, 600) self.pages = pages.Pages(categories_func) self.sections = [("stock_down", _("Get Software"), "get"), ("gtk-harddisk", _("Installed Software"), "inst"), ("applications-other", _("Apps Basket"), "basket")] if os.environ.get('XDG_CURRENT_DESKTOP') == 'GNOME': self.toolbar = toolbar.Headerbar() self.set_titlebar(self.toolbar) else: self.toolbar = toolbar.Toolbar() self.pages.sections = self.toolbar.add_sections( self.sections, True, self.pages.change_section) self.categories_button_dict = self.pages.categories.append_sections( categories_dict) self.categories_dict = categories_dict self.statusbox = statusbox.MainBox() self.progressbar = Gtk.ProgressBar() self.progressbar_cont = self.progressbar self.pkgs_count = self.statusbox.pkgs self.categorie_icon = self.statusbox.icon self.categorie_label = self.statusbox.sectionlabel self.search_pkg = self.toolbar.entry self.vbox = Gtk.VBox() self.vbox1 = Gtk.VBox() if os.environ.get('XDG_CURRENT_DESKTOP') != 'GNOME': self.vbox.pack_start(self.toolbar, False, False, 0) else: self.vbox.pack_start(self.toolbar.searchbar, False, False, 0) self.vbox.pack_start(self.vbox1, True, True, 0) self.vbox1.pack_start(self.statusbox, False, False, 0) self.vbox1.pack_start(self.pages, True, True, 0) self.vbox.pack_start(self.progressbar_cont, False, False, 0) #-Aliases for main.py----------------------------- self.basket_radio = self.toolbar.basket_radio self.remove_mai_button = self.pages.basket.remove_button self.appsinfo = self.pages.appsinfo self.apps_message = self.pages.apps_all.details_box self.installed_message = self.pages.apps_installed.details_box self.apps_all = self.pages.apps_all.apps self.apps_installed = self.pages.apps_installed.apps self.apps_basket = self.pages.basket.basketview self.no_found_box = self.pages.apps_all.nofound self.no_found_button = self.no_found_box.nofound self.no_found_labelbox = self.pages.apps_all.nofound2 self.no_installed_found = self.pages.apps_installed.nofound2 self.apps_scrolled = self.pages.apps_all.apps_cont self.installed_scrolled = self.pages.apps_installed.apps_cont self.riepilogue_label = self.pages.basket.riepilogue_label self.install_pkgs = self.pages.basket.riepilogue_bar.button self.scrot_dialog = screenshot.Dialog #------------------------------------------------- self.about = Gtk.AboutDialog() self.about.set_program_name(_("Xenta Software Center")) self.about.set_logo_icon_name("xenta-software-center") self.about.set_copyright("Copyright © 2017 Xenta OS") self.about.set_authors([ "Dindin Hernawan <*****@*****.**> [Packaing]", "Julien Lavergne <*****@*****.**> [Packaging]", "Michael Rawson <*****@*****.**> [Code, Bug Fixing]", "Stephen Smally <*****@*****.**> [Code, Bug Fixing, UI]" ]) self.about.set_comments( _("Light but user-friendly Software Center for Xenta OS")) self.about.set_website("http://www.xentaos.com/") self.about.set_version(version) self.about.set_license(license) #------------------------------------------------- self.add(self.vbox) self.show_all() self.toolbar.settings.set_can_focus(True) #------------------------------------------------- self.toolbar.get_style_context().add_class("primary-toolbar") #-Some hides or will look orrible----------------- self.progressbar_cont.set_visible(False) self.no_found_box.set_visible(False) self.no_found_labelbox.set_visible(False) self.no_installed_found.set_visible(False) self.pages.apps_installed.nofound.set_visible(False) self.statusbox.combo.set_visible(False) #------------------------------------------------- self.statusbox.combo_model.append([_("Show at least 20 results")]) self.statusbox.combo_model.append([_("Show all results")])
def __init__(self, app): super(Preferences_UI, self).__init__() control.__init__() self.set_size_request(400, -1) self.set_resizable(False) self.set_icon_name("gtk-preferences") self.connect("destroy", self.hide_window) self.set_position(Gtk.WindowPosition.CENTER) self.set_title(_("Lubuntu Software Center Preferences")) self.box = Gtk.VBox() self.box.set_spacing(5) self.box.set_border_width(5) self.bbox = Gtk.HBox() self.bbox.set_spacing(5) self.bbox2 = Gtk.HButtonBox() self.bbox2.set_spacing(5) self.bbox2.set_layout(Gtk.ButtonBoxStyle.END) self.app = app self.combo = Gtk.Switch() self.toggle = Gtk.Switch() self.scrot = Gtk.Switch() self.internet = Gtk.Switch() self.cancel = Gtk.Button.new_from_stock(Gtk.STOCK_CANCEL) self.cancel.connect("clicked", self.hide_window) self.apply = Gtk.Button.new_from_stock(Gtk.STOCK_APPLY) self.apply.connect("clicked", self.apply_preferences) self.software_source = Gtk.Button(_("Open Software Properties")) self.software_source.connect("clicked", self.app.open_software_properties) self.about = Gtk.Button.new_from_stock(Gtk.STOCK_ABOUT) self.about.connect("clicked", self.app.on_show_about) self.refresh_func = None self.combo.set_active(control.controller.expert_mode) self.toggle.set_active(control.controller.render_icons) self.scrot.set_active(control.controller.show_scrot) self.internet.set_active(control.controller.check_internet) self.bbox2.pack_start(self.apply, False, False, 0) self.bbox2.pack_start(self.cancel, False, False, 0) self.bbox.pack_start(self.software_source, False, False, 0) self.bbox.pack_end(self.about, False, False, 0) # ---------------------------------------------- lab = Gtk.Label("<b>" + _("General") + "</b>") lab.props.xalign = 0.0 lab.set_use_markup(True) self.box.pack_start(lab, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Expert Mode")), False, False, 0) self.box2.pack_end(self.combo, False, False, 0) self.box.pack_start(self.box2, False, False, 0) lab = Gtk.Label("<b>" + _("Performance") + "</b>") lab.props.xalign = 0.0 lab.set_use_markup(True) self.box.pack_start(lab, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Render Icons")), False, False, 0) self.box2.pack_end(self.toggle, False, False, 0) self.box.pack_start(self.box2, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Download Screenshots")), False, False, 0) self.box2.pack_end(self.scrot, False, False, 0) self.box.pack_start(self.box2, False, False, 0) self.box2 = Gtk.HBox() self.box2.set_border_width(5) self.box2.pack_start(Gtk.Label(_("Check connection at startup")), False, False, 0) self.box2.pack_end(self.internet, False, False, 0) self.box.pack_start(self.box2, False, False, 0) # ---------------------------------------------- self.box.pack_start(self.bbox, False, False, 0) self.box.pack_start(self.bbox2, False, False, 0) self.add(self.box)
def __init__(self, categories_func, categories_dict): '''Setting up the UI''' super(Gui, self).__init__() self.set_position(Gtk.WindowPosition.CENTER) self.set_title(_("Mint Software Center")) self.set_icon_name("mint-software-center") self.set_default_size(800, 400) self.connect("destroy", self.close_app) control.__init__() self.cssstyle = """ GtkViewport#lscviewport { background-color: @base_color; } """ self.screen = Gdk.Screen.get_default() self.providestyle = Gtk.CssProvider() self.providestyle.load_from_data(self.cssstyle) Gtk.StyleContext.add_provider_for_screen( self.screen, self.providestyle, 600) self.pages = pages.Pages(categories_func) self.sections = [ ("stock_down", _("Get Software"), "get"), ("gtk-harddisk", _("Installed Software"), "inst"), ("applications-other", _("Apps Basket"), "basket") ] self.toolbar = toolbar.Toolbar() self.pages.sections = self.toolbar.add_sections( self.sections, True, self.pages.change_section) self.categories_button_dict = self.pages.categories.append_sections( categories_dict) self.categories_dict = categories_dict self.statusbox = statusbox.MainBox() self.progressbar = Gtk.ProgressBar() self.progressbar_cont = self.progressbar self.pkgs_count = self.statusbox.pkgs self.categorie_icon = self.statusbox.icon self.categorie_label = self.statusbox.sectionlabel self.search_pkg = self.toolbar.entry self.vbox = Gtk.VBox() self.vbox1 = Gtk.VBox() #self.vbox1.set_border_width(5) #self.vbox1.set_spacing(5) self.vbox.pack_start(self.toolbar, False, False, 0) self.vbox.pack_start(self.vbox1, True, True, 0) self.vbox1.pack_start(self.statusbox, False, False, 0) self.vbox1.pack_start(self.pages, True, True, 0) self.vbox.pack_start(self.progressbar_cont, False, False, 0) #-Aliases for main.py----------------------------- self.basket_radio = self.toolbar.basket_radio self.remove_mai_button = self.pages.basket.remove_button self.appsinfo = self.pages.appsinfo self.apps_message = self.pages.apps_all.details_box self.installed_message = self.pages.apps_installed.details_box self.apps_all = self.pages.apps_all.apps self.apps_installed = self.pages.apps_installed.apps self.apps_basket = self.pages.basket.basketview self.no_found_box = self.pages.apps_all.nofound self.no_found_button = self.no_found_box.nofound self.no_found_labelbox = self.pages.apps_all.nofound2 self.no_installed_found = self.pages.apps_installed.nofound2 self.apps_scrolled = self.pages.apps_all.apps_cont self.installed_scrolled = self.pages.apps_installed.apps_cont self.riepilogue_label = self.pages.basket.riepilogue_label self.install_pkgs = self.pages.basket.riepilogue_bar.button self.scrot_dialog = screenshot.Dialog #------------------------------------------------- self.about = Gtk.AboutDialog() self.about.set_program_name(_("Mint Software Center")) self.about.set_logo_icon_name("mint-software-center") self.about.set_copyright("Copyright © 2011-12 Hyperdriveguy") self.about.set_authors([ "Julien Lavergne <*****@*****.**> [Packaging]", "Michael Rawson <*****@*****.**> [Code, Bug Fixing]", "Stephen Smally <*****@*****.**> [Code, Bug Fixing, UI]"]) self.about.set_comments(_( "Light but user-friendly Software Center for Linux Mint")) self.about.set_website( "") self.about.set_version(version) self.about.set_license(license) #------------------------------------------------- self.add(self.vbox) self.show_all() self.toolbar.settings.set_can_focus(True) #------------------------------------------------- self.toolbar.get_style_context().add_class("primary-toolbar") #-Some hides or will look orrible----------------- self.progressbar_cont.set_visible(False) self.no_found_box.set_visible(False) self.no_found_labelbox.set_visible(False) self.no_installed_found.set_visible(False) self.pages.apps_installed.nofound.set_visible(False) self.statusbox.combo.set_visible(False) #------------------------------------------------- self.statusbox.combo_model.append([_("Show at least 20 results")]) self.statusbox.combo_model.append([_("Show all results")])