~gary-lasker/software-center/add-to-launcher-after-auth-lp972710

« back to all changes in this revision

Viewing changes to softwarecenter/view/appdetailsview.py

  • Committer: Michael Vogt
  • Date: 2009-11-02 12:58:36 UTC
  • Revision ID: michael.vogt@ubuntu.com-20091102125836-omevdkzfrdg4rome
* softwarecenter/distro/Ubuntu.py:
  - add distro backend class that dynamically detects what distro
    to use and move distro specifc stuff (like screenshot url etc)
    there

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    # FIXME: we do not support warning about removal of stuff that is
68
68
    #        recommended because its not speced
69
69
    DEPENDENCY_TYPES = ("PreDepends", "Depends") #, "Recommends")
70
 
    IMPORTANT_METAPACKAGES = ("ubuntu-desktop", "kubuntu-desktop")
71
 
 
72
 
    SCREENSHOT_THUMB_URL =  "http://screenshots.ubuntu.com/thumbnail-404/%s"
73
 
    SCREENSHOT_LARGE_URL = "http://screenshots.ubuntu.com/screenshot-404/%s"
74
70
 
75
71
    # FIXME: use relative path here
76
72
    INSTALLED_ICON = "/usr/share/icons/hicolor/24x24/emblems/software-center-installed.png"
77
73
    IMAGE_LOADING = "/usr/share/icons/hicolor/32x32/animations/softwarecenter-loading.gif"
78
74
    IMAGE_LOADING_INSTALLED = "/usr/share/icons/hicolor/32x32/animations/softwarecenter-loading-installed.gif"
79
75
 
80
 
    # missing thumbnail
81
 
    IMAGE_THUMBNAIL_MISSING = "/usr/share/software-center/images/dummy-thumbnail-ubuntu.png"
82
 
    IMAGE_FULL_MISSING = "/usr/share/software-center/images/dummy-screenshot-ubuntu.png"
83
 
 
84
 
 
85
76
    __gsignals__ = {'selected':(gobject.SIGNAL_RUN_FIRST,
86
77
                                gobject.TYPE_NONE,
87
78
                                (str,str, ))
88
79
                    }
89
80
 
90
 
    def __init__(self, db, icons, cache, datadir):
 
81
    def __init__(self, db, distro, icons, cache, datadir):
91
82
        super(AppDetailsView, self).__init__(datadir)
92
83
        self.db = db
 
84
        self.distro = distro
93
85
        self.icons = icons
94
86
        self.cache = cache
95
87
        self.datadir = datadir
237
229
            iconpath = self.tf.name
238
230
        return iconpath
239
231
    def wksub_screenshot_thumbnail_url(self):
240
 
        url = self.SCREENSHOT_THUMB_URL % self.pkgname
 
232
        url = self.distro.SCREENSHOT_THUMB_URL % self.pkgname
241
233
        return url
242
234
    def wksub_screenshot_alt(self):
243
235
        return _("Application Screenshot")
328
320
            return "screenshot_thumbnail-installed"
329
321
        return "screenshot_thumbnail"
330
322
    def wksub_screenshot_thumbnail_missing(self):
331
 
        return self.IMAGE_THUMBNAIL_MISSING
 
323
        return self.distro.IMAGE_THUMBNAIL_MISSING
332
324
    def wksub_text_direction(self):
333
325
        direction = gtk.widget_get_default_direction()
334
326
        if direction ==  gtk.TEXT_DIR_RTL:
363
355
        self._run_transaction(trans)
364
356
 
365
357
    def on_screenshot_thumbnail_clicked(self):
366
 
        url = self.SCREENSHOT_LARGE_URL % self.pkgname
 
358
        url = self.distro.SCREENSHOT_LARGE_URL % self.pkgname
367
359
        title = _("%s - Screenshot") % self.appname
368
360
        d = ShowImageDialog(title, url,
369
361
                            self.IMAGE_LOADING_INSTALLED,
518
510
        socket.setdefaulttimeout(DEFAULT_SOCKET_TIMEOUT)
519
511
        urllib._urlopener = GnomeProxyURLopener()
520
512
        try:
521
 
            f = urllib.urlopen(self.SCREENSHOT_THUMB_URL % self.pkgname)
 
513
            f = urllib.urlopen(self.distro.SCREENSHOT_THUMB_URL % self.pkgname)
522
514
        except (Url404Error, IOError), e:
523
515
            logging.debug("no thumbnail image")
524
516
            self._thumbnail_is_missing = True
659
651
    from softwarecenter.apt.aptcache import AptCache
660
652
    cache = AptCache()
661
653
 
 
654
    import softwarecenter.distro
 
655
    distro = softwarecenter.distro.get_distro()
 
656
 
662
657
    # gui
663
658
    scroll = gtk.ScrolledWindow()
664
 
    view = AppDetailsView(db, icons, cache, datadir)
 
659
    view = AppDetailsView(db, distro, icons, cache, datadir)
665
660
    #view.show_app("AMOR")
666
661
    #view.show_app("3D Chess", "3dchess")
667
662
    #view.show_app("Configuration Editor")