def initBasicBox(self): '''Create item information.''' # Init. pkg = self.appInfo.pkg # Add application icon. appIcon = createAppIcon(pkg) self.appIconBox.pack_start(appIcon, False, False) # Add application name. pkgName = utils.getPkgName(pkg) (appName, appNameEventBox) = setDefaultClickableDynamicLabel( pkgName, "appName", LABEL_FONT_SIZE, ) appName.set_size_request(self.NAME_WIDTH, -1) appName.set_single_line_mode(True) appName.set_alignment(0.0, 0.5) appNameEventBox.connect( "button-press-event", lambda w, e: self.entryDetailView()) utils.showVersionTooltip(appNameEventBox, pkg) self.appNameBox.pack_start(appNameEventBox, False, False) # Add application summary. summary = utils.getPkgShortDesc(pkg) appSummaryLabel = DynamicSimpleLabel( self.appSummaryBox, summary, appTheme.getDynamicColor("appSummary"), LABEL_FONT_SIZE ) appSummary = appSummaryLabel.getLabel() appSummary.set_size_request(self.SUMMARY_WIDTH, -1) appSummary.set_single_line_mode(True) appSummary.set_ellipsize(pango.ELLIPSIZE_END) appSummary.set_alignment(0.0, 0.5) self.appSummaryBox.pack_start(appSummary, False, False) self.appStatusBox.pack_start(self.appSummaryBox, False, False)
def __init__(self, appInfo, maxWidth, parent, entryDetailCallback): '''Init application basic view.''' # Init. self.align = gtk.Alignment() self.align.set(0.0, 0.5, 1.0, 1.0) self.commentNum = 0 appBasicBox = gtk.HBox() self.align.add(appBasicBox) pkg = appInfo.pkg # Add application icon. appIcon = createAppIcon(pkg) appBasicBox.pack_start(appIcon, False, False) # Add application left box. appBox = gtk.VBox() appAlign = gtk.Alignment() appAlign.set(0.0, 0.5, 0.0, 0.0) appAlign.add(appBox) appBasicBox.pack_start(appAlign) # Add application name. pkgName = utils.getPkgName(pkg) appNameLabel = DynamicLabel( parent, pkgName, appTheme.getDynamicLabelColor("appName"), LABEL_FONT_SIZE, ) appName = appNameLabel.getLabel() appName.set_single_line_mode(True) appName.set_alignment(0.0, 0.0) self.appNameBox = gtk.HBox() self.appNameBox.pack_start(appName, False, False) self.appCommentNumBox = gtk.VBox() self.appNameBox.pack_start(self.appCommentNumBox, True, True) appNameEventBox = gtk.EventBox() appNameEventBox.add(self.appNameBox) appNameEventBox.set_visible_window(False) appNameEventBox.connect("button-press-event", lambda w, e: entryDetailCallback()) appBox.pack_start(appNameEventBox, False, False) utils.showVersionTooltip(appNameEventBox, pkg) setClickableDynamicLabel( appNameEventBox, appNameLabel, ) # Add application summary. summary = utils.getPkgShortDesc(pkg) appSummaryBox = gtk.HBox() appSummaryLabel = DynamicSimpleLabel( parent, summary, appTheme.getDynamicColor("appSummary"), LABEL_FONT_SIZE) appSummary = appSummaryLabel.getLabel() parent.connect( "size-allocate", lambda w, e: adjustLabelWidth( parent, appSummary, LABEL_FONT_SIZE / 1000, maxWidth)) appSummary.set_single_line_mode(True) appSummary.set_ellipsize(pango.ELLIPSIZE_END) appSummary.set_alignment(0.0, 0.5) appSummaryBox.pack_start(appSummary, False, False) appBox.pack_start(appSummaryBox, False, False)
def __init__(self, appInfo, maxWidth, parent, entryDetailCallback): '''Init application basic view.''' # Init. self.align = gtk.Alignment() self.align.set(0.0, 0.5, 1.0, 1.0) self.commentNum = 0 appBasicBox = gtk.HBox() self.align.add(appBasicBox) pkg = appInfo.pkg # Add application icon. appIcon = createAppIcon(pkg) appBasicBox.pack_start(appIcon, False, False) # Add application left box. appBox = gtk.VBox() appAlign = gtk.Alignment() appAlign.set(0.0, 0.5, 0.0, 0.0) appAlign.add(appBox) appBasicBox.pack_start(appAlign) # Add application name. pkgName = utils.getPkgName(pkg) appNameLabel = DynamicLabel( parent, pkgName, appTheme.getDynamicLabelColor("appName"), LABEL_FONT_SIZE, ) appName = appNameLabel.getLabel() appName.set_single_line_mode(True) appName.set_alignment(0.0, 0.0) self.appNameBox = gtk.HBox() self.appNameBox.pack_start(appName, False, False) self.appCommentNumBox = gtk.VBox() self.appNameBox.pack_start(self.appCommentNumBox, True, True) appNameEventBox = gtk.EventBox() appNameEventBox.add(self.appNameBox) appNameEventBox.set_visible_window(False) appNameEventBox.connect( "button-press-event", lambda w, e: entryDetailCallback()) appBox.pack_start(appNameEventBox, False, False) utils.showVersionTooltip(appNameEventBox, pkg) setClickableDynamicLabel( appNameEventBox, appNameLabel, ) # Add application summary. summary = utils.getPkgShortDesc(pkg) appSummaryBox = gtk.HBox() appSummaryLabel = DynamicSimpleLabel( parent, summary, appTheme.getDynamicColor("appSummary"), LABEL_FONT_SIZE ) appSummary = appSummaryLabel.getLabel() parent.connect("size-allocate", lambda w, e: adjustLabelWidth(parent, appSummary, LABEL_FONT_SIZE / 1000, maxWidth)) appSummary.set_single_line_mode(True) appSummary.set_ellipsize(pango.ELLIPSIZE_END) appSummary.set_alignment(0.0, 0.5) appSummaryBox.pack_start(appSummary, False, False) appBox.pack_start(appSummaryBox, False, False)