def __init__(self, widget, messageCallback): '''Init proxy setup.''' self.widget = widget self.messageCallback = messageCallback self.window = gtk.Window() self.window.set_decorated(False) self.window.set_resizable(False) self.window.set_transient_for(widget.get_toplevel()) self.window.connect("size-allocate", lambda w, a: updateShape(w, a, RADIUS)) self.window.set_size_request(self.WINDOW_WIDTH, self.WINDOW_HEIGHT) # Draw. drawThemeSelectWindow( self.window, appTheme.getDynamicPixbuf("skin/background.png"), appTheme.getDynamicAlphaColor("frameLigtht"), ) self.mainBox = gtk.VBox() self.mainEventBox = gtk.EventBox() self.mainEventBox.set_visible_window(False) self.mainEventBox.add(self.mainBox) self.window.add(self.mainEventBox) self.mainEventBox.connect("button-press-event", lambda w, e: utils.moveWindow(w, e, self.window)) self.titleBox = gtk.HBox() self.mainBox.pack_start(self.titleBox, False, False) self.titleAlign = gtk.Alignment() dLabel = DynamicSimpleLabel( self.titleAlign, __("Proxy Setup"), appTheme.getDynamicColor("themeSelectTitleText"), LABEL_FONT_LARGE_SIZE, ) self.titleLabel = dLabel.getLabel() alignY = 4 alignX = 20 self.titleAlign.set(0.0, 0.0, 0.0, 0.0) self.titleAlign.set_padding(alignY, alignY, alignX, alignX) self.titleAlign.add(self.titleLabel) self.titleBox.pack_start(self.titleAlign, True, True) self.closeButton = gtk.Button() self.closeButton.connect("button-release-event", lambda w, e: self.hide()) drawButton(self.closeButton, "close", "navigate") self.titleBox.pack_start(self.closeButton, False, False) self.setupBox = gtk.VBox() self.setupAlign = gtk.Alignment() self.setupAlign.set(0.0, 0.0, 1.0, 1.0) self.setupAlign.set_padding(self.ALIGN_Y, self.ALIGN_Y, self.ALIGN_X, self.ALIGN_X + 10) self.setupAlign.add(self.setupBox) self.mainBox.pack_start(self.setupAlign, False, False) self.itemLabelWidth = 8 (self.addressBox, self.addressLabel, self.addressEntry) = self.createInputItem(__("Proxy Address")) (self.portBox, self.portLabel, self.portEntry) = self.createInputItem(__("Proxy Port")) (self.userBox, self.userLabel, self.userEntry) = self.createInputItem(__("Proxy User")) (self.passwordBox, self.passwordLabel, self.passwordEntry) = self.createInputItem(__("Proxy Password"), True) self.setupBox.pack_start(self.addressBox) self.setupBox.pack_start(self.portBox) self.setupBox.pack_start(self.userBox) self.setupBox.pack_start(self.passwordBox) self.actionBox = gtk.HBox() self.actionAlign = gtk.Alignment() self.actionAlign.set(1.0, 0.5, 0.0, 0.0) self.actionAlign.set_padding(self.ACTION_ALIGN_Y, self.ACTION_ALIGN_Y, 0, 0) self.actionAlign.add(self.actionBox) self.setupBox.pack_start(self.actionAlign, True, True) buttonPaddingX = 10 self.setupButton = utils.newButtonWithoutPadding() self.setupButton.connect("button-press-event", lambda w, e: self.setProxy()) drawButton(self.setupButton, "button", "proxySetup", True, __("Proxy OK"), BUTTON_FONT_SIZE_SMALL, "buttonFont") self.actionBox.pack_start(self.setupButton, False, False, buttonPaddingX) self.cancelButton = utils.newButtonWithoutPadding() self.cancelButton.connect("button-press-event", lambda w, e: self.cancelProxy()) drawButton(self.cancelButton, "button", "proxySetup", True, __("Proxy Cancel"), BUTTON_FONT_SIZE_SMALL, "buttonFont") self.actionBox.pack_start(self.cancelButton, False, False) # Read proxy setup. self.readProxySetup() # Hide window if user click on main window. widget.connect("button-press-event", lambda w, e: self.hide())
def __init__(self, widget): '''Init new feature.''' self.widget = widget self.window = gtk.Window() self.window.set_decorated(False) self.window.set_resizable(False) self.window.set_transient_for(widget.get_toplevel()) self.window.set_property("accept-focus", False) self.window.connect("size-allocate", lambda w, a: updateShape(w, a, RADIUS)) # Draw. drawThemeSelectWindow( self.window, appTheme.getDynamicPixbuf("skin/background.png"), appTheme.getDynamicAlphaColor("frameLigtht"), ) self.mainBox = gtk.VBox() self.mainEventBox = gtk.EventBox() self.mainEventBox.set_visible_window(False) self.mainEventBox.add(self.mainBox) self.window.add(self.mainEventBox) self.mainEventBox.connect("button-press-event", lambda w, e: utils.moveWindow(w, e, self.window)) self.titleBox = gtk.HBox() self.mainBox.pack_start(self.titleBox, False, False) self.titleAlign = gtk.Alignment() dLabel = DynamicSimpleLabel( self.titleAlign, __("Software Center 2.0 New Feature"), appTheme.getDynamicColor("themeSelectTitleText"), LABEL_FONT_LARGE_SIZE, ) self.titleLabel = dLabel.getLabel() alignY = 4 alignX = 20 self.titleAlign.set(0.0, 0.0, 0.0, 0.0) self.titleAlign.set_padding(alignY, alignY, alignX, alignX) self.titleAlign.add(self.titleLabel) self.titleBox.pack_start(self.titleAlign, True, True) self.closeButton = gtk.Button() self.closeButton.connect("clicked", lambda w: self.hide()) drawButton(self.closeButton, "close", "navigate") self.titleBox.pack_start(self.closeButton, False, False) self.scrolledwindow = gtk.ScrolledWindow() self.scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) drawVScrollbar(self.scrolledwindow) self.textView = DynamicTextView( self.scrolledwindow, appTheme.getDynamicColor("background"), appTheme.getDynamicColor("newFeatureText"), None ).textView utils.addInScrolledWindow(self.scrolledwindow, self.textView) self.textViewAlign = gtk.Alignment() self.textViewAlign.set(0.5, 0.5, 1.0, 1.0) self.textViewAlign.set_padding(10, 20, 20, 20) self.textViewAlign.add(self.scrolledwindow) self.textView.set_editable(False) self.textView.set_wrap_mode(gtk.WRAP_CHAR) self.mainBox.pack_start(self.textViewAlign, True, True) self.textView.get_buffer().set_text(__("News\n")) self.window.set_size_request(self.WINDOW_WIDTH, self.WINDOW_HEIGHT) # Hide window if user click on main window. widget.connect("button-press-event", lambda w, e: self.hide())
def __init__(self, widget, messageCallback): '''Init proxy setup.''' self.widget = widget self.messageCallback = messageCallback self.window = gtk.Window() self.window.set_decorated(False) self.window.set_resizable(False) self.window.set_transient_for(widget.get_toplevel()) self.window.connect("size-allocate", lambda w, a: updateShape(w, a, RADIUS)) self.window.set_size_request(self.WINDOW_WIDTH, self.WINDOW_HEIGHT) # Draw. drawThemeSelectWindow( self.window, appTheme.getDynamicPixbuf("skin/background.png"), appTheme.getDynamicAlphaColor("frameLigtht"), ) self.mainBox = gtk.VBox() self.mainEventBox = gtk.EventBox() self.mainEventBox.set_visible_window(False) self.mainEventBox.add(self.mainBox) self.window.add(self.mainEventBox) self.mainEventBox.connect( "button-press-event", lambda w, e: utils.moveWindow(w, e, self.window)) self.titleBox = gtk.HBox() self.mainBox.pack_start(self.titleBox, False, False) self.titleAlign = gtk.Alignment() dLabel = DynamicSimpleLabel( self.titleAlign, __("Proxy Setup"), appTheme.getDynamicColor("themeSelectTitleText"), LABEL_FONT_LARGE_SIZE, ) self.titleLabel = dLabel.getLabel() alignY = 4 alignX = 20 self.titleAlign.set(0.0, 0.0, 0.0, 0.0) self.titleAlign.set_padding(alignY, alignY, alignX, alignX) self.titleAlign.add(self.titleLabel) self.titleBox.pack_start(self.titleAlign, True, True) self.closeButton = gtk.Button() self.closeButton.connect("button-release-event", lambda w, e: self.hide()) drawButton(self.closeButton, "close", "navigate") self.titleBox.pack_start(self.closeButton, False, False) self.setupBox = gtk.VBox() self.setupAlign = gtk.Alignment() self.setupAlign.set(0.0, 0.0, 1.0, 1.0) self.setupAlign.set_padding(self.ALIGN_Y, self.ALIGN_Y, self.ALIGN_X, self.ALIGN_X + 10) self.setupAlign.add(self.setupBox) self.mainBox.pack_start(self.setupAlign, False, False) self.itemLabelWidth = 8 (self.addressBox, self.addressLabel, self.addressEntry) = self.createInputItem(__("Proxy Address")) (self.portBox, self.portLabel, self.portEntry) = self.createInputItem(__("Proxy Port")) (self.userBox, self.userLabel, self.userEntry) = self.createInputItem(__("Proxy User")) (self.passwordBox, self.passwordLabel, self.passwordEntry) = self.createInputItem(__("Proxy Password"), True) self.setupBox.pack_start(self.addressBox) self.setupBox.pack_start(self.portBox) self.setupBox.pack_start(self.userBox) self.setupBox.pack_start(self.passwordBox) self.actionBox = gtk.HBox() self.actionAlign = gtk.Alignment() self.actionAlign.set(1.0, 0.5, 0.0, 0.0) self.actionAlign.set_padding(self.ACTION_ALIGN_Y, self.ACTION_ALIGN_Y, 0, 0) self.actionAlign.add(self.actionBox) self.setupBox.pack_start(self.actionAlign, True, True) buttonPaddingX = 10 self.setupButton = utils.newButtonWithoutPadding() self.setupButton.connect("button-press-event", lambda w, e: self.setProxy()) drawButton(self.setupButton, "button", "proxySetup", True, __("Proxy OK"), BUTTON_FONT_SIZE_SMALL, "buttonFont") self.actionBox.pack_start(self.setupButton, False, False, buttonPaddingX) self.cancelButton = utils.newButtonWithoutPadding() self.cancelButton.connect("button-press-event", lambda w, e: self.cancelProxy()) drawButton(self.cancelButton, "button", "proxySetup", True, __("Proxy Cancel"), BUTTON_FONT_SIZE_SMALL, "buttonFont") self.actionBox.pack_start(self.cancelButton, False, False) # Read proxy setup. self.readProxySetup() # Hide window if user click on main window. widget.connect("button-press-event", lambda w, e: self.hide())
def __init__(self): '''Init.''' gtk.gdk.threads_init() # Shape. self.topbarPixbuf = gtk.gdk.pixbuf_new_from_file("./icons/navigate/background.png") self.topHeight = self.topbarPixbuf.get_height() self.bottombarPixbuf = gtk.gdk.pixbuf_new_from_file("./icons/statusbar/background.png") self.bottomHeight = self.bottombarPixbuf.get_height() # Init apt cache. apt_pkg.init_config() apt_pkg.init_system() self.aptCache = apt.Cache() self.repoCache = repoCache.RepoCache(self.aptCache) self.detailViewDict = {} self.searchViewDict = {} self.noscreenshotList = [] # Download queue. self.downloadQueue = download.DownloadQueue( self.downloadUpdateCallback, self.downloadFinishCallback, self.downloadFailedCallback, self.message ) # Action queue. self.actionQueue = action.ActionQueue( self.actionUpdateCallback, self.actionFinishCallback, self.actionFailedCallback, self.message ) # Init widgets. self.window = self.initMainWindow() self.window.connect("size-allocate", lambda w, a: self.updateShape(w, a)) self.hasMax = False self.leftLine = gtk.Image() drawLine(self.leftLine, "#0A3050", 1) self.rightLine = gtk.Image() drawLine(self.rightLine, "#0A3050", 1) self.mainBox = gtk.VBox() self.topbox = gtk.VBox() self.topbar = gtk.EventBox() eventBoxSetBackground( self.topbar, True, False, "./icons/navigate/background.png") # make window movable or resizable even window is decorated. self.topbar.connect('button-press-event', lambda w, e: utils.moveWindow(w, e, self.window)) self.topbar.connect("button-press-event", self.doubleClickWindow) self.titlebar = titlebar.Titlebar(self.minWindow, self.toggleWindow, self.closeWindow) self.navigatebar = navigatebar.NavigateBar(self.repoCache) self.bodyBox = gtk.HBox() self.contentBox = gtk.VBox() self.recommendPage = recommendPage.RecommendPage( self.repoCache, self.switchStatus, self.downloadQueue, self.entryDetailView, ) self.repoPage = repoPage.RepoPage( self.repoCache, self.switchStatus, self.downloadQueue, self.entryDetailView, self.entrySearchView, self.sendVote, self.fetchVote, ) self.updatePage = updatePage.UpdatePage( self.repoCache, self.switchStatus, self.downloadQueue, self.entryDetailView, self.sendVote, self.fetchVote, ) self.uninstallPage = uninstallPage.UninstallPage( self.repoCache, self.actionQueue, self.entryDetailView, self.entrySearchView, self.sendVote, self.fetchVote, ) self.communityPage = communityPage.CommunityPage() self.morePage = morePage.MorePage() self.statusbar = statusbar.Statusbar() self.statusbar.eventbox.connect("button-press-event", lambda w, e: utils.resizeWindow(w, e, self.window)) self.statusbar.eventbox.connect("button-press-event", lambda w, e: utils.moveWindow(w, e, self.window)) self.window.connect_after("show", lambda w: self.createTooltips())
def __init__(self, widget): '''Init new feature.''' self.widget = widget self.window = gtk.Window() self.window.set_decorated(False) self.window.set_resizable(False) self.window.set_transient_for(widget.get_toplevel()) self.window.set_property("accept-focus", False) self.window.connect("size-allocate", lambda w, a: updateShape(w, a, RADIUS)) # Draw. drawThemeSelectWindow( self.window, appTheme.getDynamicPixbuf("skin/background.png"), appTheme.getDynamicAlphaColor("frameLigtht"), ) self.mainBox = gtk.VBox() self.mainEventBox = gtk.EventBox() self.mainEventBox.set_visible_window(False) self.mainEventBox.add(self.mainBox) self.window.add(self.mainEventBox) self.mainEventBox.connect( "button-press-event", lambda w, e: utils.moveWindow(w, e, self.window)) self.titleBox = gtk.HBox() self.mainBox.pack_start(self.titleBox, False, False) self.titleAlign = gtk.Alignment() dLabel = DynamicSimpleLabel( self.titleAlign, __("Software Center 2.0 New Feature"), appTheme.getDynamicColor("themeSelectTitleText"), LABEL_FONT_LARGE_SIZE, ) self.titleLabel = dLabel.getLabel() alignY = 4 alignX = 20 self.titleAlign.set(0.0, 0.0, 0.0, 0.0) self.titleAlign.set_padding(alignY, alignY, alignX, alignX) self.titleAlign.add(self.titleLabel) self.titleBox.pack_start(self.titleAlign, True, True) self.closeButton = gtk.Button() self.closeButton.connect("clicked", lambda w: self.hide()) drawButton(self.closeButton, "close", "navigate") self.titleBox.pack_start(self.closeButton, False, False) self.scrolledwindow = gtk.ScrolledWindow() self.scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) drawVScrollbar(self.scrolledwindow) self.textView = DynamicTextView( self.scrolledwindow, appTheme.getDynamicColor("background"), appTheme.getDynamicColor("newFeatureText"), None).textView utils.addInScrolledWindow(self.scrolledwindow, self.textView) self.textViewAlign = gtk.Alignment() self.textViewAlign.set(0.5, 0.5, 1.0, 1.0) self.textViewAlign.set_padding(10, 20, 20, 20) self.textViewAlign.add(self.scrolledwindow) self.textView.set_editable(False) self.textView.set_wrap_mode(gtk.WRAP_CHAR) self.mainBox.pack_start(self.textViewAlign, True, True) self.textView.get_buffer().set_text(__("News\n")) self.window.set_size_request(self.WINDOW_WIDTH, self.WINDOW_HEIGHT) # Hide window if user click on main window. widget.connect("button-press-event", lambda w, e: self.hide())