예제 #1
0
 def initNormalStatus(self):
     '''Init normal status.'''
     pkg = self.appInfo.pkg
         
     # Clean right box first.
     utils.containerRemoveAll(self.appAdditionBox)
     
     # Add application installed size.
     size = utils.getPkgInstalledSize(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_UNINSTALL, 
         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.confirmUninstall:
         appUninstallLabel = gtk.Label()
         appUninstallLabel.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, "你确定要卸载吗?"))
         actionButtonBox.pack_start(appUninstallLabel, False, False)
         
         appUninstallBox = gtk.HBox()
         appUninstallAlign = gtk.Alignment()
         appUninstallAlign.set(0.5, 0.5, 1.0, 1.0)
         appUninstallAlign.set_padding(ACTION_BUTTON_PADDING_Y, ACTION_BUTTON_PADDING_Y, 0, 0)
         appUninstallAlign.add(appUninstallBox)
         actionButtonBox.pack_start(appUninstallAlign, False, False)
         
         (appConfirmButton, appConfirmAlign) = newActionButton(
             "uninstall_confirm", 0.0, 0.5, 
             "cell", False, "卸载", BUTTON_FONT_SIZE_SMALL
             )
         appConfirmButton.connect("button-release-event", lambda widget, event: self.switchToUninstalling())
         
         (appCancelButton, appCancelAlign) = newActionButton(
             "uninstall_confirm", 1.0, 0.5, 
             "cell", False, "取消", BUTTON_FONT_SIZE_SMALL
             )
         appCancelButton.connect("button-release-event", lambda widget, event: self.switchToNormal(False))
         
         appUninstallBox.pack_start(appConfirmAlign)
         appUninstallBox.pack_start(appCancelAlign)
     else:
         (appUninstallBox, appUninstallAlign) = newActionButton(
             "uninstall", 0.5, 0.5,
             "cell", False, "卸载", BUTTON_FONT_SIZE_SMALL
             )
         appUninstallBox.connect("button-release-event", lambda widget, event: self.switchToNormal(True))
         actionButtonBox.pack_start(appUninstallAlign)
    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_UNINSTALL,
                                    self.sendVoteCallback)
        self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)

        # Add application installed size.
        size = utils.getPkgInstalledSize(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 action button.
        (actionButtonBox, actionButtonAlign) = createActionButton()
        self.appAdditionBox.pack_start(actionButtonAlign, False, False)

        if self.confirmUninstall:
            appUninstallLabel = gtk.Label()
            appUninstallLabel.set_markup(
                "<span foreground='%s' size='%s'>%s</span>" %
                (appTheme.getDynamicColor("uninstallConfirm").getColor(),
                 LABEL_FONT_SIZE, __("Are you sure uninstall?")))
            actionButtonBox.pack_start(appUninstallLabel, False, False)

            appUninstallBox = gtk.HBox()
            appUninstallAlign = gtk.Alignment()
            appUninstallAlign.set(0.5, 0.5, 1.0, 1.0)
            appUninstallAlign.set_padding(ACTION_BUTTON_PADDING_Y,
                                          ACTION_BUTTON_PADDING_Y, 0, 0)
            appUninstallAlign.add(appUninstallBox)
            actionButtonBox.pack_start(appUninstallAlign, False, False)

            if getDefaultLanguage() == "default":
                buttonName = "uninstall_confirm"
            else:
                buttonName = "uninstall_confirm_cn"

            (appConfirmButton, appConfirmAlign) = newActionButton(
                buttonName, 0.0, 0.5, "cell", False, __("Action Uninstall"),
                BUTTON_FONT_SIZE_SMALL, "buttonFont")
            appConfirmButton.connect(
                "button-release-event",
                lambda widget, event: self.switchToUninstalling())

            (appCancelButton, appCancelAlign) = newActionButton(
                buttonName, 1.0, 0.5, "cell", False, __("Action Cancel"),
                BUTTON_FONT_SIZE_SMALL, "buttonFont")
            appCancelButton.connect(
                "button-release-event",
                lambda widget, event: self.switchToNormal(False))

            appUninstallBox.pack_start(appConfirmAlign)
            appUninstallBox.pack_start(appCancelAlign)
        else:
            (appUninstallBox, appUninstallAlign) = newActionButton(
                "uninstall", 0.5, 0.5, "cell", False, __("Action Uninstall"),
                BUTTON_FONT_SIZE_SMALL, "buttonFont")
            appUninstallBox.connect(
                "button-release-event",
                lambda widget, event: self.switchToNormal(True))
            actionButtonBox.pack_start(appUninstallAlign)
 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_UNINSTALL, 
         self.sendVoteCallback)
     self.appAdditionBox.pack_start(self.appVoteView.eventbox, False, False)
     
     # Add application installed size.
     size = utils.getPkgInstalledSize(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 action button.
     (actionButtonBox, actionButtonAlign) = createActionButton()
     self.appAdditionBox.pack_start(actionButtonAlign, False, False)
     
     if self.confirmUninstall:
         appUninstallLabel = gtk.Label()
         appUninstallLabel.set_markup(
             "<span foreground='%s' size='%s'>%s</span>" % (
                 appTheme.getDynamicColor("uninstallConfirm").getColor(),
                 LABEL_FONT_SIZE, 
                 __("Are you sure uninstall?")))
         actionButtonBox.pack_start(appUninstallLabel, False, False)
         
         appUninstallBox = gtk.HBox()
         appUninstallAlign = gtk.Alignment()
         appUninstallAlign.set(0.5, 0.5, 1.0, 1.0)
         appUninstallAlign.set_padding(ACTION_BUTTON_PADDING_Y, ACTION_BUTTON_PADDING_Y, 0, 0)
         appUninstallAlign.add(appUninstallBox)
         actionButtonBox.pack_start(appUninstallAlign, False, False)
         
         if getDefaultLanguage() == "default":
             buttonName = "uninstall_confirm"
         else:
             buttonName = "uninstall_confirm_cn"
             
         (appConfirmButton, appConfirmAlign) = newActionButton(
             buttonName, 0.0, 0.5, 
             "cell", False, __("Action Uninstall"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
             )
         appConfirmButton.connect("button-release-event", lambda widget, event: self.switchToUninstalling())
         
         (appCancelButton, appCancelAlign) = newActionButton(
             buttonName, 1.0, 0.5, 
             "cell", False, __("Action Cancel"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
             )
         appCancelButton.connect("button-release-event", lambda widget, event: self.switchToNormal(False))
         
         appUninstallBox.pack_start(appConfirmAlign)
         appUninstallBox.pack_start(appCancelAlign)
     else:
         (appUninstallBox, appUninstallAlign) = newActionButton(
             "uninstall", 0.5, 0.5,
             "cell", False, __("Action Uninstall"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
             )
         appUninstallBox.connect("button-release-event", lambda widget, event: self.switchToNormal(True))
         actionButtonBox.pack_start(appUninstallAlign)