~evfool/software-center/lp927426

« back to all changes in this revision

Viewing changes to softwarecenter/enums.py

  • Committer: Kiwinote
  • Date: 2012-03-15 22:36:31 UTC
  • mfrom: (2867 trunk)
  • mto: This revision was merged to the branch mainline in revision 2881.
  • Revision ID: kiwinote@gmail.com-20120315223631-lvea6t5sydpkkqni
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
# pkgname of this app itself (used for "self-awareness", see spec)
23
23
SOFTWARE_CENTER_PKGNAME = 'software-center'
24
24
 
25
 
# name of the app in the keyring, untranslated, see bug #773214 for the rational
 
25
# name of the app in the keyring, untranslated, see bug #773214 for the
 
26
# rational
26
27
SOFTWARE_CENTER_NAME_KEYRING = "Ubuntu Software Center"
27
28
SOFTWARE_CENTER_SSO_DESCRIPTION = _(
28
29
    "To reinstall previous purchases, sign in to the "
31
32
 
32
33
# buy-something base url
33
34
#BUY_SOMETHING_HOST = "http://localhost:8000/"
34
 
BUY_SOMETHING_HOST = os.environ.get("SOFTWARE_CENTER_AGENT_HOST") or os.environ.get("SOFTWARE_CENTER_BUY_HOST") or "https://software-center.ubuntu.com"
35
 
BUY_SOMETHING_HOST_ANONYMOUS = os.environ.get("SOFTWARE_CENTER_AGENT_HOST") or os.environ.get("SOFTWARE_CENTER_BUY_HOST") or "http://software-center.ubuntu.com"
 
35
BUY_SOMETHING_HOST = os.environ.get("SOFTWARE_CENTER_AGENT_HOST") or \
 
36
 os.environ.get("SOFTWARE_CENTER_BUY_HOST") or \
 
37
 "https://software-center.ubuntu.com"
 
38
 
 
39
BUY_SOMETHING_HOST_ANONYMOUS = os.environ.get("SOFTWARE_CENTER_AGENT_HOST") \
 
40
    or os.environ.get("SOFTWARE_CENTER_BUY_HOST") or \
 
41
    "http://software-center.ubuntu.com"
36
42
 
37
43
# recommender
38
 
RECOMMENDER_HOST = os.environ.get("SOFTWARE_CENTER_RECOMMENDER_HOST") or "https://rec.ubuntu.com"
39
 
#RECOMMENDER_HOST = os.environ.get("SOFTWARE_CENTER_RECOMMENDER_HOST") or "https://rec.staging.ubuntu.com"
 
44
RECOMMENDER_HOST = os.environ.get("SOFTWARE_CENTER_RECOMMENDER_HOST") or \
 
45
    "https://rec.ubuntu.com"
 
46
#RECOMMENDER_HOST = os.environ.get("SOFTWARE_CENTER_RECOMMENDER_HOST") or \
 
47
#   "https://rec.staging.ubuntu.com"
40
48
 
41
49
# for the sso login.  ussoc expects the USSOC_SERVICE_URL environment variable
42
50
# to be a full path to the service root (including /api/1.0), not just the
54
62
# the server size "page" for ratings&reviews
55
63
REVIEWS_BATCH_PAGE_SIZE = 10
56
64
 
 
65
 
57
66
# the various "views" that the app has
58
67
class ViewPages:
59
68
    AVAILABLE = "view-page-available"
60
69
    INSTALLED = "view-page-installed"
61
 
    HISTORY =  "view-page-history"
 
70
    HISTORY = "view-page-history"
62
71
    SEPARATOR_1 = "view-page-separator-1"
63
 
    PENDING =  "view-page-pending"
 
72
    PENDING = "view-page-pending"
64
73
    CHANNEL = "view-page-channel"
65
74
 
66
75
    # items considered "permanent", that is, if a item disappears
72
81
                       HISTORY
73
82
                      )
74
83
 
 
84
 
75
85
# define ID values for the various buttons found in the navigation bar
76
86
class NavButtons:
77
87
    CATEGORY = "category"
78
 
    LIST     = "list"
79
 
    SUBCAT   = "subcat"
80
 
    DETAILS  = "details"
81
 
    SEARCH   = "search"
 
88
    LIST = "list"
 
89
    SUBCAT = "subcat"
 
90
    DETAILS = "details"
 
91
    SEARCH = "search"
82
92
    PURCHASE = "purchase"
83
93
    PREV_PURCHASES = "prev-purchases"
84
94
 
 
95
 
85
96
# define ID values for the action bar buttons
86
97
class ActionButtons:
87
98
    INSTALL = "install"
88
99
    ADD_TO_LAUNCHER = "add_to_launcher"
89
100
    CANCEL_ADD_TO_LAUNCHER = "cancel_add_to_launcher"
90
101
 
 
102
 
91
103
# icons
92
104
class Icons:
93
105
    APP_ICON_SIZE = 48
98
110
    GENERIC_MISSING = "gtk-missing-image"
99
111
    INSTALLED_OVERLAY = "software-center-installed"
100
112
 
 
113
 
101
114
# sorting
102
115
class SortMethods:
103
116
    (UNSORTED,
107
120
     BY_TOP_RATED,
108
121
    ) = range(5)
109
122
 
 
123
 
110
124
class ReviewSortMethods:
111
125
    REVIEW_SORT_METHODS = ['helpful', 'newest']
112
126
    REVIEW_SORT_LIST_ENTRIES = [_('Most helpful first'), _('Newest first')]
113
127
 
 
128
 
114
129
# values used in the database
115
130
class XapianValues:
116
131
    APPNAME = 170
144
159
    VERSION_INFO = 198
145
160
    SC_SUPPORTED_DISTROS = 199
146
161
 
 
162
 
147
163
# fake channels
148
164
PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME = "for-pay-needs-reinstall"
149
165
AVAILABLE_FOR_PURCHASE_MAGIC_CHANNEL_NAME = "available-for-pay"
150
166
 
 
167
 
151
168
# custom keys for the new-apps repository, correspond
152
169
# control file custom fields:
153
170
#  XB-AppName, XB-Icon, XB-Screenshot-Url, XB-Thumbnail-Url, XB-Category
158
175
    THUMBNAIL_URL = "Thumbnail-Url"
159
176
    CATEGORY = "Category"
160
177
 
 
178
 
161
179
# pkg action state constants
162
180
class PkgStates:
163
181
    (
180
198
    FORCE_VERSION,
181
199
    # the package is not found in the DB or cache
182
200
    NOT_FOUND,
 
201
    # its purchased but not found for the current series
 
202
    PURCHASED_BUT_NOT_AVAILABLE_FOR_SERIES,
183
203
    # this *needs* to be last (for test_appdetails.py) and means
184
204
    # something went wrong and we don't have a state for this PKG
185
205
    UNKNOWN,
186
 
    PURCHASED_BUT_NOT_AVAILABLE_FOR_SERIES,
187
206
    ) = range(17)
188
207
 
 
208
 
189
209
# visibility of non applications in the search results
190
210
class NonAppVisibility:
191
211
    (ALWAYS_VISIBLE,
192
212
     MAYBE_VISIBLE,
193
 
     NEVER_VISIBLE) = range (3)
 
213
     NEVER_VISIBLE) = range(3)
 
214
 
194
215
 
195
216
# application actions
196
217
class AppActions:
200
221
    APPLY = "apply_changes"
201
222
    PURCHASE = "purchase"
202
223
 
 
224
 
203
225
# transaction types
204
226
class TransactionTypes:
205
227
    INSTALL = "install"
208
230
    APPLY = "apply_changes"
209
231
    REPAIR = "repair_dependencies"
210
232
 
 
233
 
211
234
# mouse event codes for back/forward buttons
212
235
# TODO: consider whether we ought to get these values from gconf so that we
213
236
#       can be sure to use the corresponding values used by Nautilus:
223
246
TOP_RATED_CAROUSEL_LIMIT = 12
224
247
 
225
248
from .version import VERSION, DISTRO, RELEASE, CODENAME
226
 
USER_AGENT="Software Center/%s (N;) %s/%s (%s)" % (VERSION,
227
 
                                                   DISTRO,
228
 
                                                   RELEASE,
229
 
                                                   CODENAME)
 
249
USER_AGENT = "Software Center/%s (N;) %s/%s (%s)" % (
 
250
    VERSION, DISTRO, RELEASE, CODENAME)
230
251
 
231
252
# global backend switch, prefer aptdaemon, if that can not be found, use PK
232
253
USE_PACKAGEKIT_BACKEND = False
233
254
try:
234
255
    import aptdaemon
235
 
    aptdaemon # pyflaks
 
256
    aptdaemon  # pyflaks
236
257
    USE_PACKAGEKIT_BACKEND = False
237
258
except ImportError:
238
259
    try:
239
260
        from gi.repository import PackageKitGlib
240
 
        PackageKitGlib # pyflakes
 
261
        PackageKitGlib  # pyflakes
241
262
        USE_PACKAGEKIT_BACKEND = True
242
263
    except ImportError:
243
264
        raise Exception("Need either aptdaemon or PackageKitGlib")
244
265
# allow force via env (useful for testing)
245
266
if "SOFTWARE_CENTER_FORCE_PACKAGEKIT" in os.environ:
246
267
    USE_PACKAGEKIT_BACKEND = True
247
 
 
248