def initNormalStatus(self):
     '''Init normal status.'''
     pkg = self.appInfo.pkg
     
     # Clean right box first.
     utils.containerRemoveAll(self.appAdditionBox)
     
     # Add application vote information.
     self.appVoteView = VoteView(
         self.appInfo, PAGE_UPGRADE, 
         self.sendVoteCallback)
     self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)
     
     # Add application size.
     size = utils.getPkgSize(pkg)
     appSize = gtk.Label()
     appSize.set_size_request(self.SIZE_LABEL_WIDTH, -1)
     appSize.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, utils.formatFileSize(size)))
     appSize.set_alignment(1.0, 0.5)
     self.appAdditionBox.pack_start(appSize, False, False, self.APP_RIGHT_PADDING_X)
     
     # Add ignore button.
     (ignoreLabel, ignoreEventBox) = setDefaultClickableDynamicLabel(
         __("Notify again"),
         "appIgnore",
         )
     ignoreEventBox.connect("button-press-event", 
                            lambda w, e: self.removeIgnorePkgCallback([utils.getPkgName(pkg)]))
     
     ignoreLabelPaddingX = 30
     ignoreAlign = gtk.Alignment()
     ignoreAlign.set(0.0, 0.5, 0.0, 0.0)
     ignoreAlign.set_padding(0, 0, ignoreLabelPaddingX, ignoreLabelPaddingX)
     ignoreAlign.add(ignoreEventBox)
     self.appAdditionBox.pack_start(ignoreAlign, False, False)
    def initNormalStatus(self):
        '''Init normal status.'''
        pkg = self.appInfo.pkg

        # Clean right box first.
        utils.containerRemoveAll(self.appAdditionBox)

        # Add application vote information.
        self.appVoteView = VoteView(self.appInfo, PAGE_UPGRADE,
                                    self.sendVoteCallback)
        self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)

        # Add application size.
        size = utils.getPkgSize(pkg)

        appSizeLabel = DynamicSimpleLabel(
            self.appAdditionBox,
            utils.formatFileSize(size),
            appTheme.getDynamicColor("appSize"),
            LABEL_FONT_SIZE,
        )
        appSize = appSizeLabel.getLabel()

        appSize.set_size_request(self.SIZE_LABEL_WIDTH, -1)
        appSize.set_alignment(1.0, 0.5)
        self.appAdditionBox.pack_start(appSize, False, False,
                                       self.APP_RIGHT_PADDING_X)

        # Add ignore button.
        (ignoreLabel, ignoreEventBox) = setDefaultClickableDynamicLabel(
            __("Don't Notify"),
            "appIgnore",
        )
        self.appAdditionBox.pack_start(ignoreEventBox, False, False)
        ignoreEventBox.connect(
            "button-press-event",
            lambda w, e: self.addIgnorePkgCallback(utils.getPkgName(pkg)))

        # Add action button.
        (actionButtonBox, actionButtonAlign) = createActionButton()
        self.appAdditionBox.pack_start(actionButtonAlign, False, False)

        (appButton, appButtonAlign) = newActionButton("update", 0.5, 0.5,
                                                      "cell", False,
                                                      __("Action Update"),
                                                      BUTTON_FONT_SIZE_SMALL,
                                                      "buttonFont")
        appButton.connect("button-release-event",
                          lambda widget, event: self.switchToDownloading())
        actionButtonBox.pack_start(appButtonAlign)
 def initNormalStatus(self):
     '''Init normal status.'''
     pkg = self.appInfo.pkg
         
     # Clean right box first.
     utils.containerRemoveAll(self.appAdditionBox)
     
     # Add application vote information.
     self.appVoteView = VoteView(
         self.appInfo, PAGE_DOWNLOAD_MANAGE, 
         self.sendVoteCallback)
     self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)
     
     # Add application size.
     size = utils.getPkgSize(pkg)
     appSize = gtk.Label()
     appSize.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, utils.formatFileSize(size)))
     appSize.set_alignment(1.0, 0.5)
     self.appAdditionBox.pack_start(appSize, False, False, self.LIKE_PADDING_X)
     
     # Add action button.
     (actionButtonBox, actionButtonAlign) = createActionButton()
     self.appAdditionBox.pack_start(actionButtonAlign, False, False)
     if self.appInfo.status == APP_STATE_NORMAL:
         (appButton, appButtonAlign) = newActionButton(
             "install", 0.5, 0.5, 
             "cell", False, __("Action Install"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     elif self.appInfo.status == APP_STATE_UPGRADE:
         (appButton, appButtonAlign) = newActionButton(
             "update", 0.5, 0.5, 
             "cell", False, __("Action Update"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     else:
         appInstalledDynamicLabel = DynamicSimpleLabel(
             actionButtonBox,
             __("Action Installed"),
             appTheme.getDynamicColor("installed"),
             LABEL_FONT_SIZE,
             )
         appInstalledLabel = appInstalledDynamicLabel.getLabel()
         buttonImage = appTheme.getDynamicPixbuf("cell/update_hover.png").getPixbuf()
         appInstalledLabel.set_size_request(buttonImage.get_width(), buttonImage.get_height())
         actionButtonBox.pack_start(appInstalledLabel)
 def initNormalStatus(self):
     '''Init normal status.'''
     pkg = self.appInfo.pkg
         
     # Clean right box first.
     utils.containerRemoveAll(self.appAdditionBox)
     
     # Add application vote information.
     self.appVoteView = VoteView(
         self.appInfo, PAGE_DOWNLOAD_MANAGE, 
         self.sendVoteCallback)
     self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)
     
     # Add application size.
     size = utils.getPkgSize(pkg)
     appSize = gtk.Label()
     appSize.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, utils.formatFileSize(size)))
     appSize.set_alignment(1.0, 0.5)
     self.appAdditionBox.pack_start(appSize, False, False, self.LIKE_PADDING_X)
     
     # Add action button.
     (actionButtonBox, actionButtonAlign) = createActionButton()
     self.appAdditionBox.pack_start(actionButtonAlign, False, False)
     if self.appInfo.status == APP_STATE_NORMAL:
         (appButton, appButtonAlign) = newActionButton(
             "install", 0.5, 0.5, 
             "cell", False, __("Action Install"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     elif self.appInfo.status == APP_STATE_UPGRADE:
         (appButton, appButtonAlign) = newActionButton(
             "update", 0.5, 0.5, 
             "cell", False, __("Action Update"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     else:
         appInstalledDynamicLabel = DynamicSimpleLabel(
             actionButtonBox,
             __("Action Installed"),
             appTheme.getDynamicColor("installed"),
             LABEL_FONT_SIZE,
             )
         appInstalledLabel = appInstalledDynamicLabel.getLabel()
         buttonImage = appTheme.getDynamicPixbuf("cell/update_hover.png").getPixbuf()
         appInstalledLabel.set_size_request(buttonImage.get_width(), buttonImage.get_height())
         actionButtonBox.pack_start(appInstalledLabel)
    def initNormalStatus(self):
        '''Init normal status.'''
        pkg = self.appInfo.pkg
        
        # Clean right box first.
        utils.containerRemoveAll(self.appAdditionBox)
        
        # Add application vote information.
        self.appVoteView = VoteView(
            self.appInfo, PAGE_UPGRADE, 
            self.sendVoteCallback)
        self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)
        
        # Add application size.
        size = utils.getPkgSize(pkg)

        appSizeLabel = DynamicSimpleLabel(
            self.appAdditionBox,
            utils.formatFileSize(size),
            appTheme.getDynamicColor("appSize"),
            LABEL_FONT_SIZE,
            )
        appSize = appSizeLabel.getLabel()
        
        appSize.set_size_request(self.SIZE_LABEL_WIDTH, -1)
        appSize.set_alignment(1.0, 0.5)
        self.appAdditionBox.pack_start(appSize, False, False, self.APP_RIGHT_PADDING_X)
        
        # Add ignore button.
        (ignoreLabel, ignoreEventBox) = setDefaultClickableDynamicLabel(
            __("Don't Notify"),
            "appIgnore",
            )
        self.appAdditionBox.pack_start(ignoreEventBox, False, False)
        ignoreEventBox.connect("button-press-event", 
                               lambda w, e: self.addIgnorePkgCallback(utils.getPkgName(pkg)))
        
        # Add action button.
        (actionButtonBox, actionButtonAlign) = createActionButton()
        self.appAdditionBox.pack_start(actionButtonAlign, False, False)
        
        (appButton, appButtonAlign) = newActionButton(
            "update", 0.5, 0.5, "cell", False, __("Action Update"), BUTTON_FONT_SIZE_SMALL, "buttonFont")
        appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
        actionButtonBox.pack_start(appButtonAlign)
Esempio n. 6
0
 def initNormalStatus(self):
     '''Init normal status.'''
     pkg = self.appInfo.pkg
         
     # Clean right box first.
     utils.containerRemoveAll(self.appAdditionBox)
     
     # Add application size.
     size = utils.getPkgSize(pkg)
     appSize = gtk.Label()
     appSize.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, utils.formatFileSize(size)))
     appSize.set_alignment(1.0, 0.5)
     self.appAdditionBox.pack_start(appSize, False, False, self.LIKE_PADDING_X)
     
     # Add application vote information.
     self.appVoteView = VoteView(
         self.appInfo, PAGE_REPO, 
         self.entryDetailCallback,
         self.sendVoteCallback)
     self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)
     
     # Add action button.
     (actionButtonBox, actionButtonAlign) = createActionButton()
     self.appAdditionBox.pack_start(actionButtonAlign, False, False)
     if self.appInfo.status == APP_STATE_NORMAL:
         (appButton, appButtonAlign) = newActionButton(
             "install", 0.5, 0.5, 
             "cell", False, "安装", BUTTON_FONT_SIZE_SMALL
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     elif self.appInfo.status == APP_STATE_UPGRADE:
         (appButton, appButtonAlign) = newActionButton(
             "update", 0.5, 0.5, 
             "cell", False, "升级", BUTTON_FONT_SIZE_SMALL
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     else:
         appInstalledLabel = gtk.Label()
         appInstalledLabel.set_markup("<span foreground='#1A3E88' size='%s'>%s</span>" % (LABEL_FONT_SIZE, "已安装"))
         buttonImage = gtk.gdk.pixbuf_new_from_file("./icons/cell/update_hover.png")
         appInstalledLabel.set_size_request(buttonImage.get_width(), buttonImage.get_height())
         actionButtonBox.pack_start(appInstalledLabel)
    def initNormalStatus(self):
        '''Init normal status.'''
        pkg = self.appInfo.pkg

        # Clean right box first.
        utils.containerRemoveAll(self.appAdditionBox)

        # Add application vote information.
        self.appVoteView = VoteView(self.appInfo, PAGE_UPGRADE,
                                    self.sendVoteCallback)
        self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)

        # Add application size.
        size = utils.getPkgSize(pkg)
        appSize = gtk.Label()
        appSize.set_size_request(self.SIZE_LABEL_WIDTH, -1)
        appSize.set_markup("<span size='%s'>%s</span>" %
                           (LABEL_FONT_SIZE, utils.formatFileSize(size)))
        appSize.set_alignment(1.0, 0.5)
        self.appAdditionBox.pack_start(appSize, False, False,
                                       self.APP_RIGHT_PADDING_X)

        # Add ignore button.
        (ignoreLabel, ignoreEventBox) = setDefaultClickableDynamicLabel(
            __("Notify again"),
            "appIgnore",
        )
        ignoreEventBox.connect(
            "button-press-event",
            lambda w, e: self.removeIgnorePkgCallback([utils.getPkgName(pkg)]))

        ignoreLabelPaddingX = 30
        ignoreAlign = gtk.Alignment()
        ignoreAlign.set(0.0, 0.5, 0.0, 0.0)
        ignoreAlign.set_padding(0, 0, ignoreLabelPaddingX, ignoreLabelPaddingX)
        ignoreAlign.add(ignoreEventBox)
        self.appAdditionBox.pack_start(ignoreAlign, False, False)
 def initNormalStatus(self):
     '''Init normal status.'''
     pkg = self.appInfo.pkg
     
     # Clean right box first.
     utils.containerRemoveAll(self.appAdditionBox)
     
     # Add application version.
     currentVersion = pkg.installed.version
     if len(pkg.versions) == 0:
         upgradeVersion = "错误的版本, 请报告错误!"
     else:
         upgradeVersion = pkg.versions[0].version
         
     versionBox = gtk.VBox()
     versionAlign = gtk.Alignment()        
     versionAlign.set(0.0, 0.5, 0.0, 0.0)
     versionAlign.add(versionBox)
     self.appAdditionBox.pack_start(versionAlign, True, True, self.APP_RIGHT_PADDING_X)
     
     currentVersionBox = gtk.HBox()
     versionBox.pack_start(currentVersionBox, False, False)
     
     currentVersionName = gtk.Label()
     currentVersionName.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, "当前版本: "))
     currentVersionBox.pack_start(currentVersionName, False, False)
     
     currentVersionNum = gtk.Label()
     currentVersionNum.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
     currentVersionNum.set_markup("<span foreground='#333333' size='%s'>%s</span>" % (LABEL_FONT_SIZE, currentVersion))
     currentVersionNum.set_size_request(self.VERSION_LABEL_WIDTH, -1)
     currentVersionNum.set_alignment(0.0, 0.5)
     currentVersionBox.pack_start(currentVersionNum, False, False)
     
     upgradeVersionBox = gtk.HBox()
     versionBox.pack_start(upgradeVersionBox, False, False)
     
     upgradeVersionName = gtk.Label()
     upgradeVersionName.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, "升级版本: "))
     upgradeVersionBox.pack_start(upgradeVersionName, False, False)
     
     upgradeVersionNum = gtk.Label()
     upgradeVersionNum.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
     upgradeVersionNum.set_markup("<span foreground='#00BB00' size='%s'>%s</span>" % (LABEL_FONT_SIZE, upgradeVersion))
     upgradeVersionNum.set_size_request(self.VERSION_LABEL_WIDTH, -1)
     upgradeVersionNum.set_alignment(0.0, 0.5)
     upgradeVersionBox.pack_start(upgradeVersionNum, False, False)
         
     # Add application size.
     size = utils.getPkgSize(pkg)
     appSize = gtk.Label()
     appSize.set_size_request(self.SIZE_LABEL_WIDTH, -1)
     appSize.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, utils.formatFileSize(size)))
     appSize.set_alignment(1.0, 0.5)
     self.appAdditionBox.pack_start(appSize, False, False, self.APP_RIGHT_PADDING_X)
     
     # Add application vote information.
     self.appVoteView = VoteView(
         self.appInfo, PAGE_UPGRADE, 
         self.entryDetailCallback,
         self.sendVoteCallback)
     self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)
     
     # Add action button.
     (actionButtonBox, actionButtonAlign) = createActionButton()
     self.appAdditionBox.pack_start(actionButtonAlign, False, False)
     
     (appButton, appButtonAlign) = newActionButton(
         "update", 0.5, 0.5, "cell", False, "升级", BUTTON_FONT_SIZE_SMALL)
     appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
     actionButtonBox.pack_start(appButtonAlign)