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)
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 show(self, editable): """Show search completion.""" if self.showCompletion: # Move window to match entry's position. (wx, wy) = editable.window.get_origin() rect = editable.get_allocation() text = editable.get_chars(0, -1) candidates = self.getCandidatesCallback(text) if len(candidates) != 0: self.listStore.clear() for candidate in candidates: self.listStore.append(candidate) # Scroll to top first. utils.scrollToTop(self.scrolledwindow) w, h = ( rect.width, (min(len(candidates), self.MAX_CELL_NUMBER)) * self.CELL_HEIGHT + self.CELL_HEIGHT / 2, ) # FIXME, i don't know why entry'height is bigger than i need, so i decrease 8 pixel here. self.window.move(wx, wy + rect.height - 8) self.window.set_size_request(w, h) self.window.resize(w, h) self.window.show_all() else: self.window.hide_all()
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, 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 showCompletionWindow(self): '''Show completion.''' # Move window to match entry's position. (wx, wy) = self.entry.window.get_origin() rect = self.entry.get_allocation() text = self.entry.get_chars(0, -1) candidates = self.getCandidatesCallback(text) self.listStore.clear() content = self.entry.get_chars(0, -1) textColor = appTheme.getDynamicColor("completionText").getColor() keywordColor = appTheme.getDynamicColor("completionKeyword").getColor() self.listStore.append([ "<span foreground='%s'>%s</span>" % (textColor, __("Global Search")) + " <span foreground='%s'>%s</span>" % (keywordColor, content), content ]) for candidate in candidates: self.listStore.append(candidate) # Scroll to top first. utils.scrollToTop(self.scrolledwindow) if len(candidates) == 0: w, h = rect.width, self.SINGLE_CELL_HEIGHT else: w, h = rect.width, (min( len(candidates) + 1, self.MAX_CELL_NUMBER)) * (self.CELL_HEIGHT + 2) # FIXME, i don't know why entry'height is bigger than i need, so i decrease 8 pixel here. self.window.move(wx, wy + rect.height - 8) self.window.set_size_request(w, h) self.window.resize(w, h) self.window.show_all() # Focus first candidate. self.treeView.set_cursor((0)) gtk.Widget.grab_focus(self.treeView)
def showCompletionWindow(self): """Show completion.""" # Move window to match entry's position. (wx, wy) = self.entry.window.get_origin() rect = self.entry.get_allocation() text = self.entry.get_chars(0, -1) candidates = self.getCandidatesCallback(text) self.listStore.clear() content = self.entry.get_chars(0, -1) textColor = appTheme.getDynamicColor("completionText").getColor() keywordColor = appTheme.getDynamicColor("completionKeyword").getColor() self.listStore.append( [ "<span foreground='%s'>%s</span>" % (textColor, __("Global Search")) + " <span foreground='%s'>%s</span>" % (keywordColor, content), content, ] ) for candidate in candidates: self.listStore.append(candidate) # Scroll to top first. utils.scrollToTop(self.scrolledwindow) if len(candidates) == 0: w, h = rect.width, self.SINGLE_CELL_HEIGHT else: w, h = rect.width, (min(len(candidates) + 1, self.MAX_CELL_NUMBER)) * (self.CELL_HEIGHT + 2) # FIXME, i don't know why entry'height is bigger than i need, so i decrease 8 pixel here. self.window.move(wx, wy + rect.height - 8) self.window.set_size_request(w, h) self.window.resize(w, h) self.window.show_all() # Focus first candidate. self.treeView.set_cursor((0)) gtk.Widget.grab_focus(self.treeView)
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: 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)
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)