def show(self):
        '''Show application view.'''
        # Remove child widgets first.
        utils.containerRemoveAll(self.box)
        self.itemDict.clear()

        if self.appNum != 0:
            # Get application list.
            sortType = self.getSortTypeFunc()
            appList = self.getListFunc(
                self.category, sortType,
                (self.pageIndex - 1) * self.defaultRows,
                min(self.pageIndex * self.defaultRows, self.appNum))

            # Create application view.
            self.box.pack_start(self.createAppList(appList))

            # Create index view.
            indexbar = self.createIndexbar()
            if not indexbar == None:
                self.box.pack_start(indexbar)

            # Show all.
            self.box.show_all()

            # Request vote data.
            self.fetchVoteCallback(
                PAGE_REPO,
                map(lambda appInfo: utils.getPkgName(appInfo.pkg), appList))

        # Scroll ScrolledWindow to top after render.
        utils.scrollToTop(self.scrolledwindow)
Example #2
0
def initActionStatus(appAdditionBox, progress, feedback):
    '''Init action status.'''
    APP_RIGHT_PADDING_X = 20
    PROGRESS_WIDTH = 170
    
    # Clean right box first.
    utils.containerRemoveAll(appAdditionBox)
    
    # Add progress.
    progressbar = drawProgressbar(PROGRESS_WIDTH)
    progressbar.setProgress(progress)
    appAdditionBox.pack_start(progressbar.box)
    
    # Alignment box.
    alignBox = gtk.HBox()
    alignBox.set_size_request(ACTION_BUTTON_WIDTH, -1)
    appAdditionBox.pack_start(alignBox, False, False, ACTION_BUTTON_PADDING_X)
    
    # Add feedback label.
    feedbackLabel = gtk.Label()
    feedbackLabel.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, feedback))
    feedbackLabel.set_ellipsize(pango.ELLIPSIZE_END)
    feedbackLabel.set_alignment(0.5, 0.5)
    alignBox.pack_start(feedbackLabel)
    
    return (progressbar, feedbackLabel)
def initActionStatus(appAdditionBox, progress, feedback, withoutBorder=False):
    '''Init action status.'''
    APP_RIGHT_PADDING_X = 20
    PROGRESS_WIDTH = 170

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

    # Add progress.
    if withoutBorder:
        progressbar = drawProgressbarWithoutBorder(PROGRESS_WIDTH)
    else:
        progressbar = drawProgressbar(PROGRESS_WIDTH)
    progressbar.setProgress(progress)
    appAdditionBox.pack_start(progressbar.box)

    # Alignment box.
    alignBox = gtk.HBox()
    alignBox.set_size_request(ACTION_BUTTON_WIDTH, -1)
    appAdditionBox.pack_start(alignBox, False, False, ACTION_BUTTON_PADDING_X)

    # Add feedback label.
    feedbackLabel = gtk.Label()
    feedbackLabel.set_markup("<span size='%s'>%s</span>" %
                             (LABEL_FONT_SIZE, feedback))
    feedbackLabel.set_ellipsize(pango.ELLIPSIZE_END)
    feedbackLabel.set_alignment(0.5, 0.5)
    alignBox.pack_start(feedbackLabel)

    return (progressbar, feedbackLabel)
Example #4
0
 def show(self, scrollToTop=True):
     '''Show application view.'''
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     self.itemDict.clear()
     
     if self.appNum != 0:
         # Get application list.
         appList = self.getListFunc((self.pageIndex - 1) * self.defaultRows,
                                    min(self.pageIndex * self.defaultRows, self.appNum)
                                    )
         
         # Create application view.
         self.box.pack_start(self.createAppList(appList))
         
         # Create index view.
         indexbar = self.createIndexbar()
         if not indexbar == None:
             self.box.pack_start(indexbar)
             
         self.box.show_all()
         
         # Request vote data.
         self.fetchVoteCallback(
             self.pageId, 
             map (lambda appInfo: utils.getPkgName(appInfo.pkg), appList),
             self.isSearchPage)
         
     # Scroll ScrolledWindow to top after render.
     if scrollToTop:
         utils.scrollToTop(self.scrolledwindow)
 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 selectPage(self, pageId):
     '''Select recommend page.'''
     utils.containerRemoveAll(self.contentBox)
     
     self.navigatebar.pageId = pageId
     self.navigatebar.box.queue_draw()
     
     if self.detailViewDict.has_key(pageId):
         child = self.detailViewDict[pageId].scrolledWindow
     elif self.searchViewDict.has_key(pageId):
         child = self.searchViewDict[pageId].box
     else:
         if pageId == PAGE_RECOMMEND:
             child = self.recommendPage.scrolledwindow
         elif pageId == PAGE_REPO:
             child = self.repoPage.box
         elif pageId == PAGE_UPGRADE:
             child = self.updatePage.box
         elif pageId == PAGE_UNINSTALL:
             child = self.uninstallPage.box
         elif pageId == PAGE_COMMUNITY:
             child = self.communityPage.box
         else: 
             child = self.morePage.box
     
     self.contentBox.pack_start(child)
     self.contentBox.show_all()
Example #7
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 show(self, scrollToTop=True):
     '''Show application view.'''
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     self.itemDict.clear()
     
     # If i don't re-connect self.eventbox and self.box,
     # update view will show nothing.
     # I still can't understand why?
     # Maybe this is bug of GtkEventBox?
     utils.containerRemoveAll(self.eventbox)
     self.eventbox.add(self.box)
     
     if self.appNum == 0:
         notifyBox = gtk.HBox()
         notifyAlign = gtk.Alignment()
         notifyAlign.set(0.5, 0.5, 0.0, 0.0)
         notifyAlign.add(notifyBox)
         self.box.pack_start(notifyAlign)
         
         notifyIconAlignX = 5
         notifyIcon = gtk.image_new_from_file("./icons/update/smile.gif")
         notifyIconAlign = gtk.Alignment()
         notifyIconAlign.set(0.5, 1.0, 0.0, 0.0)
         notifyIconAlign.set_padding(0, 0, notifyIconAlignX, notifyIconAlignX)
         notifyIconAlign.add(notifyIcon)
         notifyBox.pack_start(notifyIconAlign)
         
         notifyLabel = gtk.Label()
         notifyLabel.set_markup("<span foreground='#1A38EE' size='%s'>%s</span>" % (LABEL_FONT_XX_LARGE_SIZE, "你的系统已经是最新的. :)"))
         notifyBox.pack_start(notifyLabel, False, False)
         
         self.box.show_all()
     else:
         # Get application list.
         appList = self.getListFunc(
             (self.pageIndex - 1) * self.defaultRows,
             min(self.pageIndex * self.defaultRows, self.appNum)
             )
         
         # Create application view.
         self.box.pack_start(self.createAppList(appList))
         
         # Create index view.
         indexbar = self.createIndexbar()
         if not indexbar == None:
             self.box.pack_start(indexbar)
             
         self.box.show_all()
         
         # Request vote data.
         self.fetchVoteCallback(
             PAGE_UPGRADE, 
             map (lambda appInfo: utils.getPkgName(appInfo.pkg), appList))
         
     # Scroll ScrolledWindow to top after render.
     if scrollToTop:
         utils.scrollToTop(self.scrolledwindow)
 def show(self):
     '''Show application view.'''
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     self.itemDict.clear()
     
     if self.appNum == 0:
         if (getDefaultLanguage() == "default"):
             paddingX = 10
         else:
             paddingX = 45
         
         notifyBox = gtk.VBox()
         notifyAlign = gtk.Alignment()
         notifyAlign.set(0.5, 0.5, 0.0, 0.0)
         notifyAlign.add(notifyBox)
         self.box.pack_start(notifyAlign)
         
         tipImage = gtk.image_new_from_pixbuf(
             gtk.gdk.pixbuf_new_from_file("../icon/tips/%s/downloadTip.png" % (getDefaultLanguage())))
         tipAlign = gtk.Alignment()
         tipAlign.set_padding(0, 0, paddingX, 0)
         tipAlign.add(tipImage)
         notifyBox.pack_start(tipAlign)
         
         penguinImage = gtk.image_new_from_pixbuf(
             gtk.gdk.pixbuf_new_from_file("../icon/tips/penguin.png"))
         penguinAlign = gtk.Alignment()
         penguinAlign.set_padding(0, 0, 0, paddingX)
         penguinAlign.add(penguinImage)
         notifyBox.pack_start(penguinAlign)
         
         self.box.show_all()
     else:
         # Get application list.
         appList = self.getListFunc(
             (self.pageIndex - 1) * self.defaultRows,
             min(self.pageIndex * self.defaultRows, self.appNum)
             )
         
         # Create application view.
         self.box.pack_start(self.createAppList(appList))
         
         # Create index view.
         indexbar = self.createIndexbar()
         if not indexbar == None:
             self.box.pack_start(indexbar)
         
         # Show all.
         self.box.show_all()
         
         # Request vote data.
         self.fetchVoteCallback(
             PAGE_DOWNLOAD_MANAGE, 
             map (lambda appInfo: utils.getPkgName(appInfo.pkg), appList))
         
     # Scroll ScrolledWindow to top after render.
     utils.scrollToTop(self.scrolledwindow)
 def show(self):
     '''Show application view.'''
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     self.itemDict.clear()
     
     if self.appNum == 0:
         if (getDefaultLanguage() == "default"):
             paddingX = 10
         else:
             paddingX = 45
         
         notifyBox = gtk.VBox()
         notifyAlign = gtk.Alignment()
         notifyAlign.set(0.5, 0.5, 0.0, 0.0)
         notifyAlign.add(notifyBox)
         self.box.pack_start(notifyAlign)
         
         tipImage = gtk.image_new_from_pixbuf(
             gtk.gdk.pixbuf_new_from_file("../icon/tips/%s/downloadTip.png" % (getDefaultLanguage())))
         tipAlign = gtk.Alignment()
         tipAlign.set_padding(0, 0, paddingX, 0)
         tipAlign.add(tipImage)
         notifyBox.pack_start(tipAlign)
         
         penguinImage = gtk.image_new_from_pixbuf(
             gtk.gdk.pixbuf_new_from_file("../icon/tips/penguin.png"))
         penguinAlign = gtk.Alignment()
         penguinAlign.set_padding(0, 0, 0, paddingX)
         penguinAlign.add(penguinImage)
         notifyBox.pack_start(penguinAlign)
         
         self.box.show_all()
     else:
         # Get application list.
         appList = self.getListFunc(
             (self.pageIndex - 1) * self.defaultRows,
             min(self.pageIndex * self.defaultRows, self.appNum)
             )
         
         # Create application view.
         self.box.pack_start(self.createAppList(appList))
         
         # Create index view.
         indexbar = self.createIndexbar()
         if not indexbar == None:
             self.box.pack_start(indexbar)
         
         # Show all.
         self.box.show_all()
         
         # Request vote data.
         self.fetchVoteCallback(
             PAGE_DOWNLOAD_MANAGE, 
             map (lambda appInfo: utils.getPkgName(appInfo.pkg), appList))
         
     # Scroll ScrolledWindow to top after render.
     utils.scrollToTop(self.scrolledwindow)
    def drawFocusInit(self):
        '''Draw focus out.'''
        # Remove child first.
        utils.containerRemoveAll(self.starBox)

        # Add waiting label.
        waitingVoteLabel = gtk.Label()
        waitingVoteLabel.set_markup("")
        self.starBox.pack_start(waitingVoteLabel)
 def drawFocusInit(self):
     '''Draw focus out.'''
     # Remove child first.
     utils.containerRemoveAll(self.starBox)
     
     # Add waiting label.
     waitingVoteLabel = gtk.Label()
     waitingVoteLabel.set_markup("")
     self.starBox.pack_start(waitingVoteLabel)
Example #13
0
 def drawFocusInit(self):
     '''Draw focus out.'''
     # Remove child first.
     utils.containerRemoveAll(self.starBox)
     utils.containerRemoveAll(self.voteBox)
     
     # Add waiting label.
     waitingVoteLabel = gtk.Label()
     waitingVoteLabel.set_markup("<span foreground='#1A3E88' size='%s'>读取评论数据...</span>" % (LABEL_FONT_SIZE))
     self.starBox.pack_start(waitingVoteLabel)
Example #14
0
 def drawFocusStar(self):
     '''Draw focus star status.'''
     # Remove child first.
     utils.containerRemoveAll(self.starBox)
     utils.containerRemoveAll(self.voteBox)
     
     # Add application vote star.
     self.starView = StarView()
     self.starBox.pack_start(self.starView.eventbox)
     self.starView.eventbox.connect("button-press-event", lambda w, e: self.sendVote())
     self.starView.eventbox.connect("button-press-event", lambda w, e: self.switchFocusStatus(self.FOCUS_NORMAL))
 def updateIgnoreNum(self, ignoreNum):
     '''Update ignore number label.'''
     utils.containerRemoveAll(self.ignoreNumBox)
     
     if ignoreNum > 0:
         (ignoreLabel, ignoreEventBox) = setDefaultClickableDynamicLabel(
             __("No Notify UpdatePage") % (ignoreNum),
             "topbarButton",
             )
         ignoreEventBox.connect("button-press-event", lambda w, e: self.showIgnorePageCallback())
         self.ignoreNumBox.add(ignoreEventBox)
         self.ignoreNumBox.show_all()
    def initDownloadPauseStatus(self,
                                appAdditionBox,
                                withoutBorder=False,
                                color=None):
        if (color == None):
            color = appTheme.getDynamicColor("statusUpdate").getColor()
        '''Init download pause status.'''
        # Clean right box first.
        utils.containerRemoveAll(appAdditionBox)

        # Add progress.
        progress = self.appInfo.downloadingProgress
        if withoutBorder:
            progressbar = drawProgressbarWithoutBorder(self.PROGRESS_WIDTH)
        else:
            progressbar = drawProgressbar(self.PROGRESS_WIDTH)
        progressbar.setProgress(progress)
        appAdditionBox.pack_start(progressbar.box)

        # Alignment box.
        (actionBox, actionAlign) = createActionButton()
        appAdditionBox.pack_start(actionAlign)

        # Add play icon.
        buttonBox = gtk.HBox()
        buttonAlign = gtk.Alignment()
        buttonAlign.set(0.5, 0.5, 0.0, 0.0)
        buttonAlign.set_padding(ACTION_BUTTON_PADDING_Y,
                                ACTION_BUTTON_PADDING_Y, 0, 0)
        buttonAlign.add(buttonBox)
        actionBox.pack_start(buttonAlign)

        continueIcon = gtk.Button()
        drawSimpleButton(continueIcon, "continue")
        continueIcon.connect("button-release-event",
                             lambda widget, event: self.switchToDownloading())
        buttonBox.pack_start(continueIcon, False, False, self.BUTTON_PADDING_X)

        # Add stop icon.
        stopIcon = gtk.Button()
        drawSimpleButton(stopIcon, "stop")
        stopIcon.connect("button-release-event",
                         lambda widget, event: self.switchToNormal())
        buttonBox.pack_start(stopIcon, False, False, self.BUTTON_PADDING_X)

        # Add pause label.
        pauseLabel = gtk.Label()
        pauseLabel.set_markup("<span foreground='%s' size='%s'>%s</span>" %
                              (color, LABEL_FONT_SIZE, __("Action Pause")))
        pauseLabel.set_width_chars(self.PROGRESS_LABEL_WIDTH_CHARS)
        pauseLabel.set_ellipsize(pango.ELLIPSIZE_END)
        pauseLabel.set_alignment(0.5, 0.5)
        actionBox.pack_start(pauseLabel)
 def updateSubCategorybar(self, category, categoryList):
     '''Update sub category bar.'''
     # Update value.
     self.category = category
     self.categoryList = categoryList
     
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     
     # Show sub-category bar.
     rect = self.box.get_allocation()
     self.showSubCategorybar(rect.width)
    def updateIgnoreNum(self, ignoreNum):
        '''Update ignore number label.'''
        utils.containerRemoveAll(self.ignoreNumBox)

        if ignoreNum > 0:
            (ignoreLabel, ignoreEventBox) = setDefaultClickableDynamicLabel(
                __("No Notify UpdatePage") % (ignoreNum),
                "topbarButton",
            )
            ignoreEventBox.connect("button-press-event",
                                   lambda w, e: self.showIgnorePageCallback())
            self.ignoreNumBox.add(ignoreEventBox)
            self.ignoreNumBox.show_all()
Example #19
0
 def drawFocusNormal(self):
     '''Draw focus normal status.'''
     # Remove child first.
     utils.containerRemoveAll(self.starBox)
     utils.containerRemoveAll(self.voteBox)
     
     # Add application vote star.
     starBox = createStarBox(self.starLevel, self.starSize)
     
     self.starBox.pack_start(starBox)
     
     self.voteLabel = gtk.Label()
     self.voteLabel.set_markup("<span foreground='#1A3E88' size='%s'>评分</span>" % (LABEL_FONT_SIZE))
     self.voteEventBox = gtk.EventBox()
     self.voteEventBox.set_visible_window(False)
     self.voteEventBox.add(self.voteLabel)
     self.voteEventBox.connect("button-press-event", lambda w, e: self.switchFocusStatus(self.FOCUS_STAR))
     self.voteBox.pack_start(self.voteEventBox)
     utils.setClickableLabel(
         self.voteEventBox,
         self.voteLabel,
         "<span foreground='#1A3E88' size='%s'>评分</span>" % (LABEL_FONT_SIZE),
         "<span foreground='#0084FF' size='%s'>评分</span>" % (LABEL_FONT_SIZE))
     
     self.rate = gtk.Label()
     self.rateEventBox = gtk.EventBox()
     self.rateEventBox.set_visible_window(False)
     self.rateEventBox.add(self.rate)
     self.rateEventBox.connect("button-press-event", 
                          lambda w, e: self.entryDetailCallback(self.pageId, self.appInfo))
     rateAlign = gtk.Alignment()
     rateAlign.set(1.0, 0.5, 0.0, 0.0)
     rateAlign.add(self.rateEventBox)
     self.voteBox.pack_start(rateAlign)
     
     if self.voteNum == 0:
         self.rate.set_markup("<span foreground='#1A3E88' size='%s'>抢沙发!</span>" % (LABEL_FONT_SIZE))
         
         utils.setClickableLabel(
             self.rateEventBox,
             self.rate,
             "<span foreground='#1A3E88' size='%s'>抢沙发!</span>" % (LABEL_FONT_SIZE),
             "<span foreground='#0084FF' size='%s'>抢沙发!</span>" % (LABEL_FONT_SIZE))
     else:
         self.rate.set_markup("<span foreground='#1A3E88' size='%s'>%s 评论</span>" % (LABEL_FONT_SIZE, self.voteNum))
         
         utils.setClickableLabel(
             self.rateEventBox,
             self.rate,
             "<span foreground='#1A3E88' size='%s'>%s 评论</span>" % (LABEL_FONT_SIZE, self.voteNum),
             "<span foreground='#0084FF' size='%s'>%s 评论</span>" % (LABEL_FONT_SIZE, self.voteNum))
    def initDownloadingStatus(self, appAdditionBox, withoutBorder=False):
        '''Init downloading status.'''
        # Clean right box first.
        utils.containerRemoveAll(appAdditionBox)

        # Add progress.
        progress = self.appInfo.downloadingProgress
        if withoutBorder:
            progressbar = drawProgressbarWithoutBorder(self.PROGRESS_WIDTH)
        else:
            progressbar = drawProgressbar(self.PROGRESS_WIDTH)
        progressbar.setProgress(progress)
        self.downloadingProgressbar = progressbar
        appAdditionBox.pack_start(progressbar.box)

        # Alignment box.
        (actionBox, actionAlign) = createActionButton()
        appAdditionBox.pack_start(actionAlign)

        # Add pause icon.
        buttonBox = gtk.HBox()
        buttonAlign = gtk.Alignment()
        buttonAlign.set(0.5, 0.5, 0.0, 0.0)
        buttonAlign.set_padding(ACTION_BUTTON_PADDING_Y,
                                ACTION_BUTTON_PADDING_Y, 0, 0)
        buttonAlign.add(buttonBox)
        actionBox.pack_start(buttonAlign)

        pauseIcon = gtk.Button()
        drawSimpleButton(pauseIcon, "pause")
        pauseIcon.connect("button-release-event",
                          lambda widget, event: self.switchToDownloadPause())
        buttonBox.pack_start(pauseIcon, False, False, self.BUTTON_PADDING_X)

        # Add stop icon.
        stopIcon = gtk.Button()
        drawSimpleButton(stopIcon, "stop")
        stopIcon.connect("button-release-event",
                         lambda widget, event: self.switchToNormal())
        buttonBox.pack_start(stopIcon, False, False, self.BUTTON_PADDING_X)

        # Add feedback label.
        feedbackLabel = gtk.Label()
        feedbackLabel.set_markup(
            "<span size='%s'>%s</span>" %
            (LABEL_FONT_SIZE, self.appInfo.downloadingFeedback))
        feedbackLabel.set_width_chars(self.PROGRESS_LABEL_WIDTH_CHARS)
        feedbackLabel.set_ellipsize(pango.ELLIPSIZE_END)
        feedbackLabel.set_alignment(0.5, 0.5)
        self.downloadingFeedbackLabel = feedbackLabel
        actionBox.pack_start(feedbackLabel)
 def onSizeAllocate(self, width):
     '''Call when signal 'size-allocate' emit.'''
     # When first time redraw, remove child and reset width. 
     if self.redrawCount == 0:
         self.redrawCount = self.redrawCount + 1
         utils.containerRemoveAll(self.box)
         self.box.set_size_request(1, -1)
     # When second time redraw, redraw with new width allocated.
     elif self.redrawCount == 1:
         self.redrawCount = self.redrawCount + 1
         self.showSubCategorybar(width)
     # When third time, reset redraw count, stop redraw.
     else:
         self.redrawCount = 0
 def drawFocusStar(self):
     '''Draw focus star status.'''
     # Remove child first.
     utils.containerRemoveAll(self.starBox)
     
     # Add application vote star.
     self.starView = StarView()
     self.starBox.pack_start(self.starView.eventbox)
     self.starView.eventbox.connect("button-press-event", lambda w, e: self.sendVote())
     self.starView.eventbox.connect("button-press-event", lambda w, e: self.switchFocusStatus(self.FOCUS_NORMAL))
     
     # Show help.
     utils.setHelpTooltip(self.starView.eventbox, __("Click Finish Vote"))
     setClickableCursor(self.starView.eventbox)
    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 drawFocusNormal(self):
     '''Draw focus normal status.'''
     # Remove child first.
     utils.containerRemoveAll(self.starBox)
     # utils.containerRemoveAll(self.voteBox)
     
     # Add application vote star.
     starBox = createStarBox(self.starLevel, self.starSize)
     self.starBox.pack_start(starBox)
     
     starBox.connect("button-press-event", lambda w, e: self.switchFocusStatus(self.FOCUS_STAR))
     
     utils.setHelpTooltip(starBox, __("Click Start Vote"))
     setClickableCursor(starBox)
Example #25
0
    def initDownloadPauseStatus(self, appAdditionBox, withoutBorder=False, color=None):
        if color == None:
            color = appTheme.getDynamicColor("statusUpdate").getColor()

        """Init download pause status."""
        # Clean right box first.
        utils.containerRemoveAll(appAdditionBox)

        # Add progress.
        progress = self.appInfo.downloadingProgress
        if withoutBorder:
            progressbar = drawProgressbarWithoutBorder(self.PROGRESS_WIDTH)
        else:
            progressbar = drawProgressbar(self.PROGRESS_WIDTH)
        progressbar.setProgress(progress)
        appAdditionBox.pack_start(progressbar.box)

        # Alignment box.
        (actionBox, actionAlign) = createActionButton()
        appAdditionBox.pack_start(actionAlign)

        # Add play icon.
        buttonBox = gtk.HBox()
        buttonAlign = gtk.Alignment()
        buttonAlign.set(0.5, 0.5, 0.0, 0.0)
        buttonAlign.set_padding(ACTION_BUTTON_PADDING_Y, ACTION_BUTTON_PADDING_Y, 0, 0)
        buttonAlign.add(buttonBox)
        actionBox.pack_start(buttonAlign)

        continueIcon = gtk.Button()
        drawSimpleButton(continueIcon, "continue")
        continueIcon.connect("button-release-event", lambda widget, event: self.switchToDownloading())
        buttonBox.pack_start(continueIcon, False, False, self.BUTTON_PADDING_X)

        # Add stop icon.
        stopIcon = gtk.Button()
        drawSimpleButton(stopIcon, "stop")
        stopIcon.connect("button-release-event", lambda widget, event: self.switchToNormal())
        buttonBox.pack_start(stopIcon, False, False, self.BUTTON_PADDING_X)

        # Add pause label.
        pauseLabel = gtk.Label()
        pauseLabel.set_markup(
            "<span foreground='%s' size='%s'>%s</span>" % (color, LABEL_FONT_SIZE, __("Action Pause"))
        )
        pauseLabel.set_width_chars(self.PROGRESS_LABEL_WIDTH_CHARS)
        pauseLabel.set_ellipsize(pango.ELLIPSIZE_END)
        pauseLabel.set_alignment(0.5, 0.5)
        actionBox.pack_start(pauseLabel)
    def drawFocusNormal(self):
        '''Draw focus normal status.'''
        # Remove child first.
        utils.containerRemoveAll(self.starBox)
        # utils.containerRemoveAll(self.voteBox)

        # Add application vote star.
        starBox = createStarBox(self.starLevel, self.starSize)
        self.starBox.pack_start(starBox)

        starBox.connect("button-press-event",
                        lambda w, e: self.switchFocusStatus(self.FOCUS_STAR))

        utils.setHelpTooltip(starBox, __("Click Start Vote"))
        setClickableCursor(starBox)
 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 updateCommentNum(self, commentNum):
        '''Update comment num.'''
        if commentNum > 0:
            utils.containerRemoveAll(self.appCommentNumBox)
            appCommentLabel = DynamicSimpleLabel(
                self.appCommentNumBox,
                __("Comment") % commentNum,
                appTheme.getDynamicColor("appComment"),
                LABEL_FONT_SIZE,
            ).getLabel()
            appCommentLabel.set_single_line_mode(True)
            appCommentLabel.set_alignment(0.0, 1.0)

            self.appCommentNumBox.pack_start(appCommentLabel, True, True)

            self.align.show_all()
 def updateCommentNum(self, commentNum):
     '''Update comment num.'''
     if commentNum > 0:
         utils.containerRemoveAll(self.appCommentNumBox)
         appCommentLabel = DynamicSimpleLabel(
             self.appCommentNumBox,
             __("Comment") % commentNum,
             appTheme.getDynamicColor("appComment"),
             LABEL_FONT_SIZE,
             ).getLabel()
         appCommentLabel.set_single_line_mode(True)
         appCommentLabel.set_alignment(0.0, 1.0)
         
         self.appCommentNumBox.pack_start(appCommentLabel, True, True)
         
         self.align.show_all()
    def drawFocusStar(self):
        '''Draw focus star status.'''
        # Remove child first.
        utils.containerRemoveAll(self.starBox)

        # Add application vote star.
        self.starView = StarView()
        self.starBox.pack_start(self.starView.eventbox)
        self.starView.eventbox.connect("button-press-event",
                                       lambda w, e: self.sendVote())
        self.starView.eventbox.connect(
            "button-press-event",
            lambda w, e: self.switchFocusStatus(self.FOCUS_NORMAL))

        # Show help.
        utils.setHelpTooltip(self.starView.eventbox, __("Click Finish Vote"))
        setClickableCursor(self.starView.eventbox)
 def initDownloadingStatus(self, appAdditionBox, withoutBorder=False):
     '''Init downloading status.'''
     # Clean right box first.
     utils.containerRemoveAll(appAdditionBox)
     
     # Add progress.
     progress = self.appInfo.downloadingProgress
     if withoutBorder:
         progressbar = drawProgressbarWithoutBorder(self.PROGRESS_WIDTH)
     else:
         progressbar = drawProgressbar(self.PROGRESS_WIDTH)
     progressbar.setProgress(progress)
     self.downloadingProgressbar = progressbar
     appAdditionBox.pack_start(progressbar.box)
     
     # Alignment box.
     (actionBox, actionAlign) = createActionButton()
     appAdditionBox.pack_start(actionAlign)
     
     # Add pause icon.
     buttonBox = gtk.HBox()
     buttonAlign = gtk.Alignment()
     buttonAlign.set(0.5, 0.5, 0.0, 0.0)
     buttonAlign.set_padding(ACTION_BUTTON_PADDING_Y, ACTION_BUTTON_PADDING_Y, 0, 0)
     buttonAlign.add(buttonBox)
     actionBox.pack_start(buttonAlign)
     
     pauseIcon = gtk.Button()
     drawSimpleButton(pauseIcon, "pause")
     pauseIcon.connect("button-release-event", lambda widget, event: self.switchToDownloadPause())
     buttonBox.pack_start(pauseIcon, False, False, self.BUTTON_PADDING_X)
     
     # Add stop icon.
     stopIcon = gtk.Button()
     drawSimpleButton(stopIcon, "stop")
     stopIcon.connect("button-release-event", lambda widget, event: self.switchToNormal())
     buttonBox.pack_start(stopIcon, False, False, self.BUTTON_PADDING_X)
     
     # Add feedback label.
     feedbackLabel = gtk.Label()
     feedbackLabel.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, self.appInfo.downloadingFeedback))
     feedbackLabel.set_width_chars(self.PROGRESS_LABEL_WIDTH_CHARS)
     feedbackLabel.set_ellipsize(pango.ELLIPSIZE_END)
     feedbackLabel.set_alignment(0.5, 0.5)
     self.downloadingFeedbackLabel = feedbackLabel
     actionBox.pack_start(feedbackLabel)
    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)
Example #34
0
    def initNormalStatus(self):
        '''Init normal status.'''
        # Clean right box first.
        utils.containerRemoveAll(self.appAdditionBox)

        # Add action button.
        (actionButtonBox, actionButtonAlign) = createActionButton()
        self.appAdditionBox.pack_start(actionButtonAlign, False, False)
        if self.appInfo.status == APP_STATE_NORMAL:
            (appButton, appButtonAlign) = newActionButton(
                "search", 0.5, 0.5, "cell", False, __("Action Install"),
                BUTTON_FONT_SIZE_LARGE, "bigButtonFont")
            appButton.connect("button-release-event",
                              lambda widget, event: self.switchToDownloading())
            actionButtonBox.pack_start(appButtonAlign)
        elif self.appInfo.status == APP_STATE_UPGRADE:
            (appButton, appButtonAlign) = newActionButton(
                "search", 0.5, 0.5, "cell", False, __("Action Update"),
                BUTTON_FONT_SIZE_LARGE, "bigButtonFont")
            appButton.connect("button-release-event",
                              lambda widget, event: self.switchToDownloading())
            actionButtonBox.pack_start(appButtonAlign)
        else:
            execPath = self.appInfo.execPath
            if execPath:
                (appButton, appButtonAlign) = newActionButton(
                    "search", 0.5, 0.5, "cell", False, __("Action Startup"),
                    BUTTON_FONT_SIZE_LARGE, "bigButtonFont")
                appButton.connect(
                    "button-release-event", lambda widget, event: self.
                    launchApplicationCallback(execPath))
                actionButtonBox.pack_start(appButtonAlign)
            else:
                appInstalledDynamicLabel = DynamicSimpleLabel(
                    actionButtonBox,
                    __("Action Installed"),
                    appTheme.getDynamicColor("slideText"),
                    LABEL_FONT_LARGE_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)
Example #35
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)
Example #36
0
 def initUpgradingStatus(self):
     '''Init upgrading status.'''
     # Clean summary box first.
     utils.containerRemoveAll(self.appStatusBox)
     
     # Create status box.
     statusPaddingY = 5
     statusBox = gtk.HBox()
     statusAlign = gtk.Alignment()
     statusAlign.set(0.0, 0.5, 0.0, 0.0)
     statusAlign.set_padding(statusPaddingY, 0, 0, 0)
     statusAlign.add(statusBox)
     self.appStatusBox.pack_start(statusAlign)
     
     # Add progressbar.
     progress = self.appInfo.downloadingProgress
     progressbar = drawProgressbar(self.PROGRESS_WIDTH)
     progressbar.setProgress(progress)
     statusBox.pack_start(progressbar.box)
     self.upgradingProgressbar = progressbar
     
     # Add action box.
     utils.containerRemoveAll(self.appActionBox)
     
     actionBox = gtk.VBox()
     actionAlign = gtk.Alignment()
     actionAlign.set(0.5, 0.5, 0.0, 0.0)
     actionAlign.add(actionBox)
     self.appActionBox.pack_start(actionAlign)
     
     # Add feedback label.
     feedbackPaddingY = 6
     feedbackLabel = gtk.Label()
     feedbackLabel.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, self.appInfo.upgradingFeedback))
     feedbackLabel.set_alignment(0.0, 0.5)
     feedbackAlign = gtk.Alignment()
     feedbackAlign.set(0.0, 0.5, 0.0, 0.0)
     feedbackAlign.set_padding(feedbackPaddingY, 0, 0, 0)
     feedbackAlign.add(feedbackLabel)
     self.upgradingFeedbackLabel = feedbackLabel
     actionBox.pack_start(feedbackAlign)
 def initNormalStatus(self):
     '''Init normal status.'''
     # Clean right box first.
     utils.containerRemoveAll(self.appAdditionBox)
     
     # Add action button.
     (actionButtonBox, actionButtonAlign) = createActionButton()
     self.appAdditionBox.pack_start(actionButtonAlign, False, False)
     if self.appInfo.status == APP_STATE_NORMAL:
         (appButton, appButtonAlign) = newActionButton(
             "search", 0.5, 0.5,  "cell", False, __("Action Install"), BUTTON_FONT_SIZE_LARGE, "bigButtonFont"
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     elif self.appInfo.status == APP_STATE_UPGRADE:
         (appButton, appButtonAlign) = newActionButton(
             "search", 0.5, 0.5, 
             "cell", False, __("Action Update"), BUTTON_FONT_SIZE_LARGE, "bigButtonFont"
             )
         appButton.connect("button-release-event", lambda widget, event: self.switchToDownloading())
         actionButtonBox.pack_start(appButtonAlign)
     else:
         execPath = self.appInfo.execPath
         if execPath:
             (appButton, appButtonAlign) = newActionButton(
                 "search", 0.5, 0.5, 
                 "cell", False, __("Action Startup"), BUTTON_FONT_SIZE_LARGE, "bigButtonFont"
                 )
             appButton.connect("button-release-event", lambda widget, event: self.launchApplicationCallback(execPath))
             actionButtonBox.pack_start(appButtonAlign)
         else:
             appInstalledDynamicLabel = DynamicSimpleLabel(
                 actionButtonBox,
                 __("Action Installed"),
                 appTheme.getDynamicColor("slideText"),
                 LABEL_FONT_LARGE_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 show(self, scrollToTop=True):
     '''Show application view.'''
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     self.itemDict.clear()
     
     # If i don't re-connect self.eventbox and self.box,
     # update view will show nothing.
     # I still can't understand why?
     # Maybe this is bug of GtkEventBox?
     utils.containerRemoveAll(self.eventbox)
     self.eventbox.add(self.box)
     
     if self.appNum != 0:
         # Get application list.
         appList = self.getListFunc((self.pageIndex - 1) * self.defaultRows,
                                    min(self.pageIndex * self.defaultRows, self.appNum)
                                    )
         
         # Create application view.
         self.box.pack_start(self.createAppList(appList))
         
         # Create index view.
         indexbar = self.createIndexbar()
         if not indexbar == None:
             self.box.pack_start(indexbar)
             
         self.box.show_all()
         
         # Request vote data.
         self.fetchVoteCallback(
             self.pageId, 
             map (lambda appInfo: utils.getPkgName(appInfo.pkg), appList),
             self.isSearchPage)
         
     # Scroll ScrolledWindow to top after render.
     if scrollToTop:
         utils.scrollToTop(self.scrolledwindow)
 def show(self, scrollToTop=True):
     '''Show application view.'''
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     self.itemDict.clear()
     
     # If i don't re-connect self.eventbox and self.box,
     # update view will show nothing.
     # I still can't understand why?
     # Maybe this is bug of GtkEventBox?
     utils.containerRemoveAll(self.eventbox)
     self.eventbox.add(self.box)
     
     if self.appNum != 0:
         # Get application list.
         appList = self.getListFunc((self.pageIndex - 1) * self.defaultRows,
                                    min(self.pageIndex * self.defaultRows, self.appNum)
                                    )
         
         # Create application view.
         self.box.pack_start(self.createAppList(appList))
         
         # Create index view.
         indexbar = self.createIndexbar()
         if not indexbar == None:
             self.box.pack_start(indexbar)
             
         self.box.show_all()
         
         # Request vote data.
         self.fetchVoteCallback(
             self.pageId, 
             map (lambda appInfo: utils.getPkgName(appInfo.pkg), appList),
             self.isSearchPage)
         
     # Scroll ScrolledWindow to top after render.
     if scrollToTop:
         utils.scrollToTop(self.scrolledwindow)
    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)
Example #41
0
 def initNormalStatus(self):
     '''Init normal status.'''
     pkg = self.appInfo.pkg
     
     # Clean feedback box.
     utils.containerRemoveAll(self.appFeedbackBox)
     utils.containerRemoveAll(self.appActionBox)
     utils.containerRemoveAll(self.appStatusBox)
     
     # Add summary.
     self.appStatusBox.pack_start(self.appSummaryBox, False, False)
     
     # Add action button.
     appButtonBox = gtk.VBox()
     self.appActionBox.pack_start(appButtonBox, False, False, self.APP_RIGHT_PADDING_X)
     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())
         appButtonBox.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())
         appButtonBox.pack_start(appButtonAlign)
     else:
         execPath = self.appInfo.execPath
         if execPath:
             (appButton, appButtonAlign) = newActionButton(
                 "update", 0.5, 0.5, 
                 "cell", False, __("Action Startup"), BUTTON_FONT_SIZE_SMALL, "buttonFont"
                 )
             appButton.connect("button-release-event", lambda widget, event: self.launchApplicationCallback(execPath))
             appButtonBox.pack_start(appButtonAlign)
         else:
             appInstalledDynamicLabel = DynamicSimpleLabel(
                 appButtonBox,
                 __("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())
             appButtonBox.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_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 updateSlideItem(self):
     '''Update slide item.'''
     utils.containerRemoveAll(self.slideItemBox)        
     self.slideItemBox.pack_start(self.getSlideItem(self.targetIndex).itemFrame)
 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)
 def show(self, scrollToTop=True):
     '''Show application view.'''
     # Remove child widgets first.
     utils.containerRemoveAll(self.box)
     self.itemDict.clear()
     
     # If i don't re-connect self.eventbox and self.box,
     # update view will show nothing.
     # I still can't understand why?
     # Maybe this is bug of GtkEventBox?
     utils.containerRemoveAll(self.eventbox)
     self.eventbox.add(self.box)
     
     if self.appNum == 0:
         if (getDefaultLanguage() == "default"):
             paddingX = 10
         else:
             paddingX = 0
         
         notifyBox = gtk.VBox()
         notifyAlign = gtk.Alignment()
         notifyAlign.set(0.5, 0.5, 0.0, 0.0)
         notifyAlign.add(notifyBox)
         self.box.pack_start(notifyAlign)
         
         tipImage = gtk.image_new_from_pixbuf(
             gtk.gdk.pixbuf_new_from_file("../icon/tips/%s/updateTip.png" % (getDefaultLanguage())))
         tipAlign = gtk.Alignment()
         tipAlign.set_padding(0, 0, paddingX, 0)
         tipAlign.add(tipImage)
         notifyBox.pack_start(tipAlign)
         
         penguinImage = gtk.image_new_from_pixbuf(
             gtk.gdk.pixbuf_new_from_file("../icon/tips/penguin.png"))
         penguinAlign = gtk.Alignment()
         penguinAlign.set_padding(0, 0, 0, paddingX)
         penguinAlign.add(penguinImage)
         notifyBox.pack_start(penguinAlign)
         
         self.box.show_all()
     else:
         # Get application list.
         appList = self.getListFunc(
             (self.pageIndex - 1) * self.defaultRows,
             min(self.pageIndex * self.defaultRows, self.appNum)
             )
         
         # Create application view.
         self.box.pack_start(self.createAppList(appList))
         
         # Create index view.
         indexbar = self.createIndexbar()
         if not indexbar == None:
             self.box.pack_start(indexbar)
             
         self.box.show_all()
         
         # Request vote data.
         self.fetchVoteCallback(
             PAGE_UPGRADE, 
             map (lambda appInfo: utils.getPkgName(appInfo.pkg), appList))
         
     # Scroll ScrolledWindow to top after render.
     if scrollToTop:
         utils.scrollToTop(self.scrolledwindow)
Example #46
0
 def updateSlideItem(self):
     '''Update slide item.'''
     utils.containerRemoveAll(self.slideItemBox)
     self.slideItemBox.pack_start(
         self.getSlideItem(self.targetIndex).itemFrame)
    def show(self, scrollToTop=True):
        '''Show application view.'''
        # Remove child widgets first.
        utils.containerRemoveAll(self.box)
        self.itemDict.clear()

        # If i don't re-connect self.eventbox and self.box,
        # update view will show nothing.
        # I still can't understand why?
        # Maybe this is bug of GtkEventBox?
        utils.containerRemoveAll(self.eventbox)
        self.eventbox.add(self.box)

        if self.appNum == 0:
            if (getDefaultLanguage() == "default"):
                paddingX = 10
            else:
                paddingX = 0

            notifyBox = gtk.VBox()
            notifyAlign = gtk.Alignment()
            notifyAlign.set(0.5, 0.5, 0.0, 0.0)
            notifyAlign.add(notifyBox)
            self.box.pack_start(notifyAlign)

            tipImage = gtk.image_new_from_pixbuf(
                gtk.gdk.pixbuf_new_from_file("../icon/tips/%s/updateTip.png" %
                                             (getDefaultLanguage())))
            tipAlign = gtk.Alignment()
            tipAlign.set_padding(0, 0, paddingX, 0)
            tipAlign.add(tipImage)
            notifyBox.pack_start(tipAlign)

            penguinImage = gtk.image_new_from_pixbuf(
                gtk.gdk.pixbuf_new_from_file("../icon/tips/penguin.png"))
            penguinAlign = gtk.Alignment()
            penguinAlign.set_padding(0, 0, 0, paddingX)
            penguinAlign.add(penguinImage)
            notifyBox.pack_start(penguinAlign)

            self.box.show_all()
        else:
            # Get application list.
            appList = self.getListFunc((self.pageIndex - 1) * self.defaultRows,
                                       min(self.pageIndex * self.defaultRows,
                                           self.appNum))

            # Create application view.
            self.box.pack_start(self.createAppList(appList))

            # Create index view.
            indexbar = self.createIndexbar()
            if not indexbar == None:
                self.box.pack_start(indexbar)

            self.box.show_all()

            # Request vote data.
            self.fetchVoteCallback(
                PAGE_UPGRADE,
                map(lambda appInfo: utils.getPkgName(appInfo.pkg), appList))

        # Scroll ScrolledWindow to top after render.
        if scrollToTop:
            utils.scrollToTop(self.scrolledwindow)
Example #48
0
 def initDownloadPauseStatus(self):
     '''Init download pause status.'''
     # Clean summary box first.
     utils.containerRemoveAll(self.appStatusBox)
     
     # Create status box.
     statusPaddingY = 5
     statusBox = gtk.HBox()
     statusAlign = gtk.Alignment()
     statusAlign.set(0.0, 0.5, 0.0, 0.0)
     statusAlign.set_padding(statusPaddingY, 0, 0, 0)
     statusAlign.add(statusBox)
     self.appStatusBox.pack_start(statusAlign)
     
     # Add progressbar.
     progress = self.appInfo.downloadingProgress
     progressbar = drawProgressbar(self.PROGRESS_WIDTH)
     progressbar.setProgress(progress)
     statusBox.pack_start(progressbar.box)
     self.downloadingProgressbar = progressbar
     
     # Add action box.
     utils.containerRemoveAll(self.appActionBox)
     
     actionBox = gtk.VBox()
     actionAlign = gtk.Alignment()
     actionAlign.set(0.5, 0.5, 0.0, 0.0)
     actionAlign.add(actionBox)
     self.appActionBox.pack_start(actionAlign)
     
     # Add pause icon.
     buttonPaddingY = 8
     buttonBox = gtk.HBox()
     buttonAlign = gtk.Alignment()
     buttonAlign.set(0.5, 0.0, 0.0, 0.0)
     buttonAlign.set_padding(buttonPaddingY, 0, 0, 0)
     buttonAlign.add(buttonBox)
     actionBox.pack_start(buttonAlign, False, False)
     
     continueIcon = gtk.Button()
     drawSimpleButton(continueIcon, "continue")
     continueIcon.connect("button-release-event", lambda widget, event: self.switchToDownloading())
     buttonBox.pack_start(continueIcon, False, False, self.BUTTON_PADDING_X)
     
     # Add stop icon.
     stopIcon = gtk.Button()
     drawSimpleButton(stopIcon, "stop")
     stopIcon.connect("button-release-event", lambda widget, event: self.switchToNormal())
     buttonBox.pack_start(stopIcon, False, False, self.BUTTON_PADDING_X)
     
     # Add feedback label.
     feedbackPaddingY = 5
     feedbackLabel = gtk.Label()
     feedbackLabel.set_markup("<span size='%s'>%s</span>" % (LABEL_FONT_SIZE, self.appInfo.downloadingFeedback))
     feedbackLabel.set_size_request(self.STATUS_WIDTH, -1)
     feedbackAlign = gtk.Alignment()
     feedbackAlign.set(1.0, 0.0, 0.0, 0.0)
     feedbackAlign.set_padding(feedbackPaddingY, 0, 0, 0)
     feedbackAlign.add(feedbackLabel)
     self.downloadingFeedbackLabel = feedbackLabel
     actionBox.pack_start(feedbackAlign)