/usr/share/pyshared/LSC/UI.py is in lubuntu-software-center 0.0.8-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | #!/usr/bin/python
# -*- coding:UTF-8 -*-
# Copyright (c) Stephen Smally <stephen.smally@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
from gi.repository import Gtk
from gi.repository import Gdk
from widgets import toolbar
from widgets import statusbox
from widgets import pages
from widgets import screenshot
import control
import gettext
_ = gettext.gettext
version = "Version %s" % control.version
global license
license = '''Lubuntu Software Center
Copyright © 2011-12 Lubuntu Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
'''
import sys
from . import LOG
class Gui(Gtk.Window):
def __init__(self, categories_func, categories_dict):
'''Setting up the UI'''
super(Gui, self).__init__()
self.set_position(Gtk.WindowPosition.CENTER)
self.set_title(_("Lubuntu Software Center"))
self.set_icon_name("lubuntu-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(_("Lubuntu Software Center"))
self.about.set_logo_icon_name("lubuntu-software-center")
self.about.set_copyright("Copyright © 2011-12 Lubuntu Team")
self.about.set_authors([
"Julien Lavergne <gilir@ubuntu.com> [Packaging]",
"Michael Rawson <michaelrawson76@gmail.com> [Code, Bug Fixing]",
"Stephen Smally <eco.stefi@fastwebnet.it> [Code, Bug Fixing, UI]"])
self.about.set_comments(_(
"Light but user-friendly Software Center for Lubuntu"))
self.about.set_website(
"https://www.launchpad.net/lubuntu-software-center")
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 close_app(self, widget):
""" close the app
"""
if Gtk.main_level() == 0:
LOG.info("closing before the regular main loop was run")
sys.exit(0)
self.destroy()
try:
Gtk.main_quit()
except:
LOG.exception("Gtk.main_quit failed")
sys.exit(0)
|