~mmcg069/software-center/prelight-icon-onhover

17 by Michael Vogt
initial UI
1
#!/usr/bin/python
68 by Michael Vogt
add copyrights information
2
# Copyright (C) 2009 Canonical
3
#
4
# Authors:
5
#  Michael Vogt
6
#
7
# This program is free software; you can redistribute it and/or modify it under
8
# the terms of the GNU General Public License as published by the Free Software
325 by Michael Vogt
update license to GPLv3
9
# Foundation; version 3.
68 by Michael Vogt
add copyrights information
10
#
11
# This program is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14
# details.
15
#
16
# You should have received a copy of the GNU General Public License along with
17
# this program; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 by Michael Vogt
initial UI
19
305 by Michael Vogt
* software-store:
20
# thread init is also required otherwise both gst and webkit are unhappy
303 by Michael Vogt
software-store: add import pygtk;pygtk.require header
21
import pygtk
22
pygtk.require ("2.0")
23
import gobject
24
gobject.threads_init()
372 by Michael Vogt
* Merged from Matthew McGowan:
25
import gtk
303 by Michael Vogt
software-store: add import pygtk;pygtk.require header
26
280 by Michael Vogt
add more missing gettext glue
27
import gettext
18 by Michael Vogt
make the installed/availabe view work
28
import logging
47 by Michael Vogt
* AppCenter/view/catview.py:
29
import os
259 by Michael Vogt
merged lp:~sil/software-store/run-uninstalled, many
30
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
31
from softwarecenter.enums import *
32
from softwarecenter.version import *
910.1.2 by Geliy Sokolov
Add log.py replacement for logging
33
935 by Michael Vogt
merged lp:~hellium/software-center/logging, thanks to
34
import softwarecenter.log 
259 by Michael Vogt
merged lp:~sil/software-store/run-uninstalled, many
35
143 by Michael Vogt
merge optparse support from rugby471 (thanks!)
36
from optparse import OptionParser
128.1.7 by Andrew
added commandline argument handling infrastructure, added error message constrcutor and half the code to handle going to a package from the commandline (hopefully mvo and supply the other half :-] )
37
910.1.2 by Geliy Sokolov
Add log.py replacement for logging
38
17 by Michael Vogt
initial UI
39
if __name__ == "__main__":
143 by Michael Vogt
merge optparse support from rugby471 (thanks!)
40
867.2.56 by Kiwinote
Update man file to reflect apturl and gdebi capabilities
41
    parser = OptionParser("usage: %prog [options] [package-name | apturl | deb-file]", 
284 by Michael Vogt
* setup.py:
42
                          version="%prog "+VERSION)
750 by Michael Vogt
make ExecutionTime() use the softwarecenter.performance logger
43
    parser.add_option("--debug", action="store_true",
143 by Michael Vogt
merge optparse support from rugby471 (thanks!)
44
                      help="enable debug mode", default=False)
750 by Michael Vogt
make ExecutionTime() use the softwarecenter.performance logger
45
    parser.add_option("--debug-filter", 
46
                      help="show only specific messages. supported currently: "
47
                           "'softwarecenter.performance'")
372 by Michael Vogt
* Merged from Matthew McGowan:
48
    parser.add_option("--force-rtl", action="store_true",
49
                      help="force rtl mode (useful for debugging)", 
50
                      default=False)
841.1.1 by Gary Lasker
only enable LP integration when --enable-lp at startup
51
    # FIXME:  REMOVE THIS option once launchpad integration is enabled
52
    #         by default
53
    parser.add_option("--enable-lp", action="store_true",
841.1.3 by Gary Lasker
tweak help message to indicate this is a developer option
54
                      help="enable launchpad integration (for development use)", 
841.1.1 by Gary Lasker
only enable LP integration when --enable-lp at startup
55
                      default=False)
1066 by Michael Vogt
really enable buy-something by default
56
    parser.add_option("--disable-buy", action="store_true",
915.1.62 by Kiwinote
softwareware typo
57
                      help="disable support to buy software",
1066 by Michael Vogt
really enable buy-something by default
58
                      default=False)
980 by Michael Vogt
merged lp:~mvo/software-center/buy-something, currently needs to
59
143 by Michael Vogt
merge optparse support from rugby471 (thanks!)
60
    (options, args) = parser.parse_args()
910.1.1 by Geliy Sokolov
Fix --debug-filter and --debug options
61
    
750 by Michael Vogt
make ExecutionTime() use the softwarecenter.performance logger
62
    if options.debug_filter:
935 by Michael Vogt
merged lp:~hellium/software-center/logging, thanks to
63
        softwarecenter.log.add_filters_from_string(options.debug_filter)
750 by Michael Vogt
make ExecutionTime() use the softwarecenter.performance logger
64
        # implies general debug
65
        options.debug = True
66
        
143 by Michael Vogt
merge optparse support from rugby471 (thanks!)
67
    if options.debug:
935 by Michael Vogt
merged lp:~hellium/software-center/logging, thanks to
68
        softwarecenter.log.root.setLevel(level=logging.DEBUG)
143 by Michael Vogt
merge optparse support from rugby471 (thanks!)
69
    else:
935 by Michael Vogt
merged lp:~hellium/software-center/logging, thanks to
70
        softwarecenter.log.root.setLevel(level=logging.INFO)
372 by Michael Vogt
* Merged from Matthew McGowan:
71
    
72
    # override text direction for testing purposes
73
    if options.force_rtl:
74
        gtk.widget_set_default_direction(gtk.TEXT_DIR_RTL)
143 by Michael Vogt
merge optparse support from rugby471 (thanks!)
75
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
76
    if os.path.exists("./data/ui/SoftwareCenter.ui"):
910.1.1 by Geliy Sokolov
Fix --debug-filter and --debug options
77
        logging.getLogger("softwarecenter").info("Using data (UI, xapian) from current dir")
68 by Michael Vogt
add copyrights information
78
        datadir = "./data"
242.1.1 by stuart.langridge at canonical
Allow running software-store uninstalled, direct from a bzr checkout
79
        xapian_base_path = datadir
68 by Michael Vogt
add copyrights information
80
    else:
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
81
        datadir = "/usr/share/software-center/"
259 by Michael Vogt
merged lp:~sil/software-store/run-uninstalled, many
82
        xapian_base_path = XAPIAN_BASE_PATH
87.3.2 by Andrew
we have a manpage :-)
83
    
330 by Michael Vogt
renamed to "Ubuntu Software Center" and software-center (LP: #436648)
84
    from softwarecenter.app import SoftwareCenterApp
867.2.5 by Kiwinote
Load installed_pane on demand, so we canselect the correct app when launching an app in the installed_pane
85
867.3.4 by Kiwinote
initial merge with trunk
86
    app = SoftwareCenterApp(datadir, xapian_base_path, options, args)
442 by Michael Vogt
merge lp:~rugby471/software-center/software-store-andrew,
87
    app.run(args)
17 by Michael Vogt
initial UI
88