我们从Python开源项目中,提取了以下25个代码示例,用于说明如何使用gtk.Table()。
def __init__(self,servers): self.servers = servers; self.serverInfo = {}; table = gtk.Table(60,50); self.window = gtk.Window(); inputEntry = self.build_InputEntry(); menuBar = self.build_Menu(); self.noteBook = self.build_Note(); self.messageView = self.build_MessageView(); table.attach(menuBar,0,60,0,10); table.attach(self.noteBook,0,50,11,50, gtk.EXPAND, gtk.FILL); table.attach(self.messageView, 51, 60, 11, 50); table.attach(inputEntry,0,60,51,60) self.window.set_default_size(1000,700); self.window.add(table); self.window.show_all(); self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) gtk.main();
def createPanelSettingsWidgets(self): """Create the Panel Settings widgets.""" self.tablePanelSettings = gtk.Table(rows=5, columns=3, homogeneous=False) self.tablePanelSettings.set_row_spacings(5) self.tablePanelSettings.set_col_spacings(5) createLabel(self.tablePanelSettings, text="Window Manager Menu", gridX=0, gridY=0, xPadding=10) self.panelMenu = createCheckButton(self.tablePanelSettings, active=False, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("wm_menu", self.panelMenu) createLabel(self.tablePanelSettings, text="Place In Window Manager Dock", gridX=0, gridY=1, xPadding=10) self.panelDock = createCheckButton(self.tablePanelSettings, active=False, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("panel_dock", self.panelDock) createLabel(self.tablePanelSettings, text="Panel Layer", gridX=0, gridY=2, xPadding=10) self.panelLayer = createComboBox(self.tablePanelSettings, ["bottom", "top", "normal"], gridX=1, gridY=2, handler=self.changeOccurred) self.registerComponent("panel_layer", self.panelLayer) createLabel(self.tablePanelSettings, text="Strut Policy", gridX=0, gridY=3, xPadding=10) self.panelAutohideStrut = createComboBox(self.tablePanelSettings, ["none", "minimum", "follow_size"], gridX=1, gridY=3, handler=self.changeOccurred) self.registerComponent("strut_policy", self.panelAutohideStrut) createLabel(self.tablePanelSettings, text="Panel Monitor (all, 1, 2, ...)", gridX=0, gridY=4, xPadding=10) self.panelMonitor = createEntry(self.tablePanelSettings, maxSize=6, width=8, text=PANEL_MONITOR, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("panel_monitor", self.panelMonitor)
def createPanelAutohideWidgets(self): """Create the Panel Autohide widgets.""" self.tablePanelAutohide = gtk.Table(rows=4, columns=3, homogeneous=False) self.tablePanelAutohide.set_row_spacings(5) self.tablePanelAutohide.set_col_spacings(5) createLabel(self.tablePanelAutohide, text="Autohide Panel", gridX=0, gridY=0, xPadding=10) self.panelAutohide = createCheckButton(self.tablePanelAutohide, active=False, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("autohide", self.panelAutohide) createLabel(self.tablePanelAutohide, text="Autohide Show Timeout (seconds)", gridX=0, gridY=1, xPadding=10) self.panelAutohideShow = createEntry(self.tablePanelAutohide, maxSize=6, width=8, text=PANEL_AUTOHIDE_SHOW, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("autohide_show_timeout", self.panelAutohideShow) createLabel(self.tablePanelAutohide, text="Autohide Hide Timeout (seconds)", gridX=0, gridY=2, xPadding=10) self.panelAutohideHide = createEntry(self.tablePanelAutohide, maxSize=6, width=8, text=PANEL_AUTOHIDE_HIDE, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("autohide_hide_timeout", self.panelAutohideHide) createLabel(self.tablePanelAutohide, text="Autohide Hidden Height", gridX=0, gridY=3, xPadding=10) self.panelAutohideHeight = createEntry(self.tablePanelAutohide, maxSize=6, width=8, text=PANEL_AUTOHIDE_HEIGHT, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("autohide_height", self.panelAutohideHeight)
def createMouseWidgets(self): """Creates the Mouse widgets.""" self.tableMouse = gtk.Table(rows=4, columns=3, homogeneous=False) self.tableMouse.set_row_spacings(5) self.tableMouse.set_col_spacings(5) mouseCmds = ["none", "close", "toggle", "iconify", "shade", "toggle_iconify", "maximize_restore", "desktop_left", "desktop_right", "next_task", "prev_task"] createLabel(self.tableMouse, text="Middle Mouse Click Action", gridX=0, gridY=0, xPadding=10) self.mouseMiddle = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=0, handler=self.changeOccurred) self.registerComponent("mouse_middle", self.mouseMiddle) createLabel(self.tableMouse, text="Right Mouse Click Action", gridX=0, gridY=1, xPadding=10) self.mouseRight = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=1, handler=self.changeOccurred) self.registerComponent("mouse_right", self.mouseRight) createLabel(self.tableMouse, text="Mouse Wheel Scroll Up Action", gridX=0, gridY=2, xPadding=10) self.mouseUp = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=2, handler=self.changeOccurred) self.registerComponent("mouse_scroll_up", self.mouseUp) createLabel(self.tableMouse, text="Mouse Wheel Scroll Down Action", gridX=0, gridY=3, xPadding=10) self.mouseDown = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=3, handler=self.changeOccurred) self.registerComponent("mouse_scroll_down", self.mouseDown)
def __init__(self, max_depth_value): self.on_max_depth_changed = None max_depth_entry = self.max_depth_entry = gtk.SpinButton( gtk.Adjustment(value=max_depth_value, lower=1, upper=100, step_incr=1, page_incr=10), digits=0) max_depth_entry.get_adjustment().connect('value_changed', self._max_depth_changed, max_depth_entry) max_depth_entry.set_alignment(0) max_depth_label = gtk.Label() max_depth_label.set_alignment(1, 0.5) max_depth_label.set_text_with_mnemonic('Maximum _Depth') max_depth_label.set_mnemonic_widget(max_depth_entry) legend = self._create_legend() table = self.view = gtk.Table(2, 3) table.set_border_width(8) table.set_row_spacings(8) table.set_col_spacings(8) table.attach(max_depth_label, 0, 1, 0, 1, gtk.FILL, gtk.FILL) table.attach(max_depth_entry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL) table.attach(gtk.Label(), 2, 3, 0, 1) # space filler table.attach(legend, 0, 3, 1, 2)
def __make_ui(self, settings): self.__table = gtk.Table(3, 2) self.__table.set_row_spacings(3) self.__table.set_col_spacings(10) self.__row = 0 self.__port = self.__make_port(settings and settings.port or None) self.__modl = self.__make_model() self.__vend = self.__make_vendor(self.__modl) self.__make_field(_("Port"), self.__port) self.__make_field(_("Vendor"), self.__vend) self.__make_field(_("Model"), self.__modl) if settings and settings.radio_class: common.combo_select(self.__vend, settings.radio_class.VENDOR) self.__modl.get_model().clear() self.__modl.append_text(settings.radio_class.MODEL) common.combo_select(self.__modl, settings.radio_class.MODEL) self.__vend.set_sensitive(False) self.__modl.set_sensitive(False) self.__table.show() self.vbox.pack_start(self.__table, 1, 1, 1)
def _setup_table(self): """Called by __init__ to set up my main table. You can easily override me instead of clobbering __init__. """ table = gtk.Table(len(self.propertyLabels), 2) self.container.add(table) table.set_name("PropertyTable") self.subtable['properties'] = table row = 0 for p, name in self.propertyLabels: label = gtk.Label(name) label.set_name("PropertyName") label.set_data("property", p) table.attach(label, 0, 1, row, row + 1) label.set_alignment(0, 0) row = row + 1 # XXX: make these guys collapsable for g, name in self.groupLabels: table = gtk.Table(1, 2) self.container.add(table) table.set_name("AttributeGroupTable") self.subtable[g] = table label = gtk.Label(name) label.set_name("AttributeGroupTitle") table.attach(label, 0, 2, 0, 1)
def new_table(wids): """Creates a gtk.Table with two rows, use it for forms""" p = gtk.Table(rows=len(wids) or 1, columns=2, homogeneous=False) p.set_col_spacings(5) p.set_row_spacings(5) if len(wids) < 1: wid = gtk.Label("Empty") p.attach(wid, 0, 2, 0, 1) p.show_all() return p for i, row in enumerate(wids): if isinstance(row, basestring): wid = Label("<b>%s</b>" % row) p.attach(wid, 0, 2, i, i+1) wid.show() if i > 0: p.set_row_spacing(i-1, 10) elif isinstance(row, (tuple, list)): label, field = row wid = new_label_for(label, field) p.attach(wid, 0, 1, i, i+1, xoptions=gtk.FILL) p.attach(field, 1, 2, i, i+1) wid.show() field.show() sw = gtk.ScrolledWindow() sw.set_shadow_type(gtk.SHADOW_NONE) sw.set_policy(hscrollbar_policy=gtk.POLICY_NEVER, vscrollbar_policy=gtk.POLICY_AUTOMATIC) sw.add_with_viewport(p) p.show() sw.show() return sw # new_table()
def createPanelDisplayWidgets(self): """Create the Panel Display widgets.""" self.tablePanelDisplay = gtk.Table(rows=6, columns=3, homogeneous=False) self.tablePanelDisplay.set_row_spacings(5) self.tablePanelDisplay.set_col_spacings(5) createLabel(self.tablePanelDisplay, text="Position", gridX=0, gridY=0, xPadding=10) self.panelPosY = createComboBox(self.tablePanelDisplay, ["bottom", "top", "center"], gridX=1, gridY=0, handler=self.changeOccurred) self.panelPosX = createComboBox(self.tablePanelDisplay, ["left", "right", "center"], gridX=2, gridY=0, handler=self.changeOccurred) # Note: registered below createLabel(self.tablePanelDisplay, text="Panel Orientation", gridX=0, gridY=1, xPadding=10) self.panelOrientation = createComboBox(self.tablePanelDisplay, ["horizontal", "vertical"], gridX=1, gridY=1, handler=self.changeOccurred) self.registerComponent("panel_position", (self.panelPosY, self.panelPosX, self.panelOrientation)) self.panelSizeLabel = createLabel(self.tablePanelDisplay, text="Size (width, height)", gridX=0, gridY=2, xPadding=10) self.panelSizeX = createEntry(self.tablePanelDisplay, maxSize=6, width=8, text=PANEL_SIZE_X, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) self.panelSizeY = createEntry(self.tablePanelDisplay, maxSize=6, width=8, text=PANEL_SIZE_Y, gridX=2, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("panel_size", (self.panelSizeX, self.panelSizeY)) createLabel(self.tablePanelDisplay, text="Margin (x, y)", gridX=0, gridY=3, xPadding=10) self.panelMarginX = createEntry(self.tablePanelDisplay, maxSize=6, width=8, text=PANEL_MARGIN_X, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) self.panelMarginY = createEntry(self.tablePanelDisplay, maxSize=6, width=8, text=PANEL_MARGIN_Y, gridX=2, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("panel_margin", (self.panelMarginX, self.panelMarginY)) createLabel(self.tablePanelDisplay, text="Padding (x, y)", gridX=0, gridY=4, xPadding=10) self.panelPadX = createEntry(self.tablePanelDisplay, maxSize=6, width=8, text=PANEL_PADDING_X, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.panelPadY = createEntry(self.tablePanelDisplay, maxSize=6, width=8, text=PANEL_PADDING_Y, gridX=2, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tablePanelDisplay, text="Horizontal Spacing", gridX=0, gridY=5, xPadding=10) self.panelSpacing = createEntry(self.tablePanelDisplay, maxSize=6, width=8, text=TASKBAR_SPACING, gridX=1, gridY=5, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("panel_padding", (self.panelPadX, self.panelPadY, self.panelSpacing)) createLabel(self.tablePanelDisplay, text="Panel Background ID", gridX=0, gridY=6, xPadding=10) self.panelBg = createComboBox(self.tablePanelDisplay, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=6, handler=self.changeOccurred) self.registerComponent("panel_background_id", self.panelBg)
def createTaskbarWidgets(self): """Create the Taskbar widgets.""" self.tableTaskbar = gtk.Table(rows=5, columns=3, homogeneous=False) self.tableTaskbar.set_row_spacings(5) self.tableTaskbar.set_col_spacings(5) createLabel(self.tableTaskbar, text="Taskbar Mode", gridX=0, gridY=0, xPadding=10) self.taskbarMode = createComboBox(self.tableTaskbar, ["single_desktop", "multi_desktop"], gridX=1, gridY=0, handler=self.changeOccurred) self.registerComponent("taskbar_mode", self.taskbarMode) createLabel(self.tableTaskbar, text="Padding (x, y)", gridX=0, gridY=1, xPadding=10) self.taskbarPadX = createEntry(self.tableTaskbar, maxSize=6, width=8, text=TASKBAR_PADDING_X, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.taskbarPadY = createEntry(self.tableTaskbar, maxSize=6, width=8, text=TASKBAR_PADDING_Y, gridX=2, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskbar, text="Horizontal Spacing", gridX=0, gridY=2, xPadding=10) self.taskbarSpacing = createEntry(self.tableTaskbar, maxSize=6, width=8, text=TASK_SPACING, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("taskbar_padding", (self.taskbarPadX, self.taskbarPadY, self.taskbarSpacing)) createLabel(self.tableTaskbar, text="Taskbar Background ID", gridX=0, gridY=3, xPadding=10) self.taskbarBg = createComboBox(self.tableTaskbar, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=3, handler=self.changeOccurred) self.registerComponent("taskbar_background_id", self.taskbarBg) createLabel(self.tableTaskbar, text="Active Taskbar Background ID", gridX=0, gridY=4, xPadding=10) self.taskbarActiveBg = createComboBox(self.tableTaskbar, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=4, handler=self.changeOccurred) self.taskbarActiveBgEnable = createCheckButton(self.tableTaskbar, text="Enable", active=False, gridX=2, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("taskbar_active_background_id", self.taskbarActiveBg)
def createNormalTasksWidgets(self): """Create the Normal Tasks widgets.""" self.tableTaskDefault = gtk.Table(rows=6, columns=3, homogeneous=False) self.tableTaskDefault.set_row_spacings(5) self.tableTaskDefault.set_col_spacings(5) createLabel(self.tableTaskDefault, text="Normal Task Background ID", gridX=0, gridY=0, xPadding=10) self.taskBg = createComboBox(self.tableTaskDefault, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=0, handler=self.changeOccurred) self.registerComponent("task_background_id", self.taskBg) createLabel(self.tableTaskDefault, text="Note: Default values of 0 for each of these settings leaves icons unchanged!", gridX=0, gridY=1, sizeX=3, xPadding=10) createLabel(self.tableTaskDefault, text="Normal Icon Alpha (0 to 100)", gridX=0, gridY=2, xPadding=10) self.iconHue = createEntry(self.tableTaskDefault, maxSize=6, width=8, text=ICON_ALPHA, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskDefault, text="Normal Icon Saturation (-100 to 100)", gridX=0, gridY=3, xPadding=10) self.iconSat = createEntry(self.tableTaskDefault, maxSize=6, width=8, text=ICON_SAT, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskDefault, text="Normal Icon Brightness (-100 to 100)", gridX=0, gridY=4, xPadding=10) self.iconBri = createEntry(self.tableTaskDefault, maxSize=6, width=8, text=ICON_BRI, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("task_icon_asb", (self.iconHue, self.iconSat, self.iconBri)) createLabel(self.tableTaskDefault, text="Normal Font Color", gridX=0, gridY=5, xPadding=10) self.fontCol = createEntry(self.tableTaskDefault, maxSize=7, width=9, text="", gridX=1, gridY=5, xExpand=True, yExpand=False, handler=None, name="fontCol") self.fontCol.connect("activate", self.colorTyped) self.fontColButton = createColorButton(self.tableTaskDefault, color=self.defaults["fgColor"], useAlpha=True, name="fontCol", gridX=2, gridY=5, handler=self.colorChange) self.fontCol.set_text(self.defaults["fgColor"]) # Add this AFTER we set color to avoid "changed" event self.fontCol.connect("changed", self.changeOccurred) self.registerComponent("task_font_color", (self.fontCol, self.fontColButton))
def createActiveTasksWidgets(self): """Create the Active Tasks widgets.""" self.tableTaskActive = gtk.Table(rows=6, columns=3, homogeneous=False) self.tableTaskActive.set_row_spacings(5) self.tableTaskActive.set_col_spacings(5) createLabel(self.tableTaskActive, text="Active Task Background ID", gridX=0, gridY=0, xPadding=10) self.taskActiveBg = createComboBox(self.tableTaskActive, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=0, handler=self.changeOccurred) self.registerComponent("task_active_background_id", self.taskActiveBg) createLabel(self.tableTaskActive, text="Note: Default values of 0 for each of these settings leaves icons unchanged!", gridX=0, gridY=1, sizeX=3, xPadding=10) createLabel(self.tableTaskActive, text="Active Icon Alpha (0 to 100)", gridX=0, gridY=2, xPadding=10) self.activeIconHue = createEntry(self.tableTaskActive, maxSize=6, width=8, text=ACTIVE_ICON_ALPHA, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskActive, text="Active Icon Saturation (-100 to 100)", gridX=0, gridY=3, xPadding=10) self.activeIconSat = createEntry(self.tableTaskActive, maxSize=6, width=8, text=ACTIVE_ICON_SAT, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskActive, text="Active Icon Brightness (-100 to 100)", gridX=0, gridY=4, xPadding=10) self.activeIconBri = createEntry(self.tableTaskActive, maxSize=6, width=8, text=ACTIVE_ICON_BRI, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("task_active_icon_asb", (self.activeIconHue, self.activeIconSat, self.activeIconBri)) createLabel(self.tableTaskActive, text="Active Font Color", gridX=0, gridY=5, xPadding=10) self.fontActiveCol = createEntry(self.tableTaskActive, maxSize=7, width=9, text="", gridX=1, gridY=5, xExpand=True, yExpand=False, handler=None, name="fontActiveCol") self.fontActiveCol.connect("activate", self.colorTyped) self.fontActiveColButton = createColorButton(self.tableTaskActive, color=self.defaults["fgColor"], useAlpha=True, name="fontActiveCol", gridX=2, gridY=5, handler=self.colorChange) self.fontActiveCol.set_text(self.defaults["fgColor"]) # Add this AFTER we set color to avoid "changed" event self.fontActiveCol.connect("changed", self.changeOccurred) self.registerComponent("task_active_font_color", (self.fontActiveCol, self.fontActiveColButton))
def createUrgentTasksWidgets(self): """Create the Urgent Tasks widgets.""" self.tableTaskUrgent = gtk.Table(rows=6, columns=3, homogeneous=False) self.tableTaskUrgent.set_row_spacings(5) self.tableTaskUrgent.set_col_spacings(5) createLabel(self.tableTaskUrgent, text="Urgent Task Background ID", gridX=0, gridY=0, xPadding=10) self.taskUrgentBg = createComboBox(self.tableTaskUrgent, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=0, handler=self.changeOccurred) self.registerComponent("task_urgent_background_id", self.taskUrgentBg) createLabel(self.tableTaskUrgent, text="Note: Default values of 0 for each of these settings leaves icons unchanged!", gridX=0, gridY=1, sizeX=3, xPadding=10) createLabel(self.tableTaskUrgent, text="Urgent Icon Alpha (0 to 100)", gridX=0, gridY=2, xPadding=10) self.urgentIconHue = createEntry(self.tableTaskUrgent, maxSize=6, width=8, text=URGENT_ICON_ALPHA, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskUrgent, text="Urgent Icon Saturation (-100 to 100)", gridX=0, gridY=3, xPadding=10) self.urgentIconSat = createEntry(self.tableTaskUrgent, maxSize=6, width=8, text=URGENT_ICON_SAT, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskUrgent, text="Urgent Icon Brightness (-100 to 100)", gridX=0, gridY=4, xPadding=10) self.urgentIconBri = createEntry(self.tableTaskUrgent, maxSize=6, width=8, text=URGENT_ICON_BRI, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("task_urgent_icon_asb", (self.urgentIconHue, self.urgentIconSat, self.urgentIconBri)) createLabel(self.tableTaskUrgent, text="Urgent Font Color", gridX=0, gridY=5, xPadding=10) self.fontUrgentCol = createEntry(self.tableTaskUrgent, maxSize=7, width=9, text="", gridX=1, gridY=5, xExpand=True, yExpand=False, handler=None, name="fontUrgentCol") self.fontUrgentCol.connect("activate", self.colorTyped) self.fontUrgentColButton = createColorButton(self.tableTaskUrgent, color=self.defaults["fgColor"], useAlpha=True, name="fontUrgentCol", gridX=2, gridY=5, handler=self.colorChange) self.fontUrgentCol.set_text(self.defaults["fgColor"]) # Add this AFTER we set color to avoid "changed" event self.fontUrgentCol.connect("changed", self.changeOccurred) self.registerComponent("task_urgent_font_color", (self.fontUrgentCol, self.fontUrgentColButton))
def createIconifiedTasksWidgets(self): """Create the Iconified Tasks widgets.""" self.tableTaskIconified = gtk.Table(rows=6, columns=3, homogeneous=False) self.tableTaskIconified.set_row_spacings(5) self.tableTaskIconified.set_col_spacings(5) createLabel(self.tableTaskIconified, text="Iconified Task Background ID", gridX=0, gridY=0, xPadding=10) self.taskIconifiedBg = createComboBox(self.tableTaskIconified, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=0, handler=self.changeOccurred) self.registerComponent("task_iconified_background_id", self.taskIconifiedBg) createLabel(self.tableTaskIconified, text="Note: Default values of 0 for each of these settings leaves icons unchanged!", gridX=0, gridY=1, sizeX=3, xPadding=10) createLabel(self.tableTaskIconified, text="Iconified Icon Alpha (0 to 100)", gridX=0, gridY=2, xPadding=10) self.iconifiedIconHue = createEntry(self.tableTaskIconified, maxSize=6, width=8, text=ICONIFIED_ICON_ALPHA, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskIconified, text="Iconified Icon Saturation (-100 to 100)", gridX=0, gridY=3, xPadding=10) self.iconifiedIconSat = createEntry(self.tableTaskIconified, maxSize=6, width=8, text=ICONIFIED_ICON_SAT, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTaskIconified, text="Iconified Icon Brightness (-100 to 100)", gridX=0, gridY=4, xPadding=10) self.iconifiedIconBri = createEntry(self.tableTaskIconified, maxSize=6, width=8, text=ICONIFIED_ICON_BRI, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("task_iconified_icon_asb", (self.iconifiedIconHue, self.iconifiedIconSat, self.iconifiedIconBri)) createLabel(self.tableTaskIconified, text="Iconified Font Color", gridX=0, gridY=5, xPadding=10) self.fontIconifiedCol = createEntry(self.tableTaskIconified, maxSize=7, width=9, text="", gridX=1, gridY=5, xExpand=True, yExpand=False, handler=None, name="fontIconifiedCol") self.fontIconifiedCol.connect("activate", self.colorTyped) self.fontIconifiedColButton = createColorButton(self.tableTaskIconified, color=self.defaults["fgColor"], useAlpha=True, name="fontIconifiedCol", gridX=2, gridY=5, handler=self.colorChange) self.fontIconifiedCol.set_text(self.defaults["fgColor"]) # Add this AFTER we set color to avoid "changed" event self.fontIconifiedCol.connect("changed", self.changeOccurred) self.registerComponent("task_iconified_font_color", (self.fontIconifiedCol, self.fontIconifiedColButton))
def createTooltipsWidgets(self): """Creates the Tooltips widgets.""" self.tableTooltip = gtk.Table(rows=7, columns=3, homogeneous=False) self.tableTooltip.set_row_spacings(5) self.tableTooltip.set_col_spacings(5) createLabel(self.tableTooltip, text="Show Tooltips", gridX=0, gridY=0, xPadding=10) self.tooltipShow = createCheckButton(self.tableTooltip, active=False, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("tooltip", self.tooltipShow) createLabel(self.tableTooltip, text="Padding (x, y)", gridX=0, gridY=1, xPadding=10) self.tooltipPadX = createEntry(self.tableTooltip, maxSize=6, width=8, text=TOOLTIP_PADDING_X, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.tooltipPadY = createEntry(self.tableTooltip, maxSize=6, width=8, text=TOOLTIP_PADDING_Y, gridX=2, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("tooltip_padding", (self.tooltipPadX, self.tooltipPadY)) createLabel(self.tableTooltip, text="Tooltip Show Timeout (seconds)", gridX=0, gridY=2, xPadding=10) self.tooltipShowTime = createEntry(self.tableTooltip, maxSize=6, width=8, text=TOOLTIP_SHOW_TIMEOUT, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("tooltip_show_timeout", self.tooltipShowTime) createLabel(self.tableTooltip, text="Tooltip Hide Timeout (seconds)", gridX=0, gridY=3, xPadding=10) self.tooltipHideTime = createEntry(self.tableTooltip, maxSize=6, width=8, text=TOOLTIP_HIDE_TIMEOUT, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("tooltip_hide_timeout", self.tooltipHideTime) createLabel(self.tableTooltip, text="Tooltip Background ID", gridX=0, gridY=4, xPadding=10) self.tooltipBg = createComboBox(self.tableTooltip, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=4, handler=self.changeOccurred) self.registerComponent("tooltip_background_id", self.tooltipBg) createLabel(self.tableTooltip, text="Tooltip Font", gridX=0, gridY=5, xPadding=10) self.tooltipFont = createFontButton(self.tableTooltip, font=self.defaults["font"], gridX=1, gridY=5, handler=self.changeOccurred) self.registerComponent("tooltip_font", self.tooltipFont) createLabel(self.tableTooltip, text="Tooltip Font Color", gridX=0, gridY=6, xPadding=10) self.tooltipFontCol = createEntry(self.tableTooltip, maxSize=7, width=9, text="", gridX=1, gridY=6, xExpand=True, yExpand=False, handler=None, name="tooltipFontCol") self.tooltipFontCol.connect("activate", self.colorTyped) self.tooltipFontColButton = createColorButton(self.tableTooltip, color=self.defaults["fgColor"], useAlpha=True, name="tooltipFontCol", gridX=2, gridY=6, handler=self.colorChange) self.tooltipFontCol.set_text(self.defaults["fgColor"]) # Add this AFTER we set color to avoid "changed" event self.tooltipFontCol.connect("changed", self.changeOccurred) self.registerComponent("tooltip_font_color", (self.tooltipFontCol, self.tooltipFontColButton))
def addBg(self): """Adds a new background to the list of backgrounds.""" self.bgs += [gtk.Table(4, 3, False)] createLabel(self.bgs[-1], text="Corner Rounding (px)", gridX=0, gridY=0, xPadding=10) createEntry(self.bgs[-1], maxSize=7, width=9, text=BG_ROUNDING, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred, name="rounded") createLabel(self.bgs[-1], text="Background Color", gridX=0, gridY=1, xPadding=10) temp = gtk.Entry(7) temp.set_width_chars(9) temp.set_name("bgColEntry") temp.set_text(self.defaults["bgColor"]) temp.connect("changed", self.changeOccurred) temp.connect("activate", self.colorTyped) self.bgs[-1].attach(temp, 1, 2, 1, 2, xoptions=gtk.EXPAND) temp = gtk.ColorButton(gtk.gdk.color_parse(self.defaults["bgColor"])) temp.set_use_alpha(True) temp.set_name("bgCol") temp.connect("color-set", self.colorChange) self.bgs[-1].attach(temp, 2, 3, 1, 2, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND) createLabel(self.bgs[-1], text="Border Width (px)", gridX=0, gridY=2, xPadding=10) createEntry(self.bgs[-1], maxSize=7, width=9, text=BG_BORDER, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred, name="border") createLabel(self.bgs[-1], text="Border Color", gridX=0, gridY=3, xPadding=10) temp = gtk.Entry(7) temp.set_width_chars(9) temp.set_name("borderColEntry") temp.connect("activate", self.colorTyped) temp.set_text(self.defaults["borderColor"]) temp.connect("changed", self.changeOccurred) self.bgs[-1].attach(temp, 1, 2, 3, 4, xoptions=gtk.EXPAND) temp = gtk.ColorButton(gtk.gdk.color_parse(self.defaults["borderColor"])) temp.set_use_alpha(True) temp.set_name("borderCol") temp.connect("color-set", self.colorChange) self.bgs[-1].attach(temp, 2, 3, 3, 4, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND) # Note: Only set init to True when initialising background styles. # This prevents unwanted calls to changeOccurred()
def _build_ui(self): self._display = gtk.Table(20, 2) self._store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) self._tree = gtk.TreeView(self._store) rend = gtk.CellRendererText() tvc = gtk.TreeViewColumn('Element', rend, text=0) self._tree.append_column(tvc) self._tree.connect('button_press_event', self._tree_click) self._tree.set_size_request(200, -1) self.root = gtk.HBox(False, 3) sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) sw.add(self._tree) sw.show() self.root.pack_start(sw, 0, 0, 0) sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) sw.add_with_viewport(self._display) sw.show() self.root.pack_start(sw, 1, 1, 1) self._tree.show() self._display.show() self.root.show()
def save_shot(self): # create a new window dialog = gtk.Dialog("Manual ScreenShot", None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dialog.set_size_request(400, 250) dialog.set_title("Manual ScreenShot Comment ECEL V2.0") table = gtk.Table(5,2,False) table.show() # create ip row ipLabel = gtk.Label("IP") ipEntry = gtk.Entry() table.attach(ipLabel, 0, 1, 0, 1) table.attach(ipEntry, 1, 2, 0, 1) ipLabel.show() ipEntry.show() # create Port row portLabel = gtk.Label("Port") portEntry = gtk.Entry() table.attach(portLabel, 0, 1, 1, 2) table.attach(portEntry, 1, 2, 1, 2) portLabel.show() portEntry.show() # create initial row initialLabel = gtk.Label("Initials") initialEntry = gtk.Entry() table.attach(initialLabel, 0, 1, 2, 3) table.attach(initialEntry, 1, 2, 2, 3) initialLabel.show() initialEntry.show() #create the comment entry field maxChar = 64 commentEntry = gtk.Entry() commentEntry.set_max_length(maxChar) commentEntry.insert_text("Enter Comment") commentEntry.select_region(0, len(commentEntry.get_text())) table.attach(commentEntry, 0, 2, 3, 4) commentEntry.show() dialog.vbox.pack_start(table) response = dialog.run() self.ip_entry_text = ipEntry.get_text() self.port_entry_text = portEntry.get_text() self.initial_entry_text = initialEntry.get_text() self.comment_entry_text = commentEntry.get_text() dialog.hide_all() dialog.destroy() return response
def __init__(self, *args, **kwargs): self.window = gtk.Window() self.window.set_title("Create An Image") self.window.set_icon_from_file(os.path.join(WORKINGDIR, "data", "icon.png")) colour = gtk.gdk.color_parse(DARKCOL) self.window.modify_bg(gtk.STATE_NORMAL, colour) self.vvbox = gtk.VBox() self.table = gtk.Table(5, 5) self.table.set_border_width(2) self.table.set_row_spacings(2) self.table.set_col_spacings(2) self.buttons = {} for y in range(5): for x in range(5): eb = gtk.EventBox() i = gtk.Image() i.set_from_file(os.path.join(WORKINGDIR, "data", "selected.png")) i.show() eb.add(i) eb.hide() eb.modify_bg(gtk.STATE_NORMAL, colour) eb.connect_object("button-press-event", self.togglePart, (x, y)) eb2 = gtk.EventBox() i2 = gtk.Image() i2.set_from_file(os.path.join(WORKINGDIR, "data", "unselected.png")) i2.show() eb2.add(i2) eb2.show() eb2.modify_bg(gtk.STATE_NORMAL, colour) eb2.connect_object("button-press-event", self.togglePart, (x, y)) self.buttons[(x, y)] = (eb, eb2) self.table.attach(eb, x, x + 1, y, y + 1) self.table.attach(eb2, x, x + 1, y, y + 1) self.table.show() self.vvbox.pack_start(self.table) hbox = gtk.HBox() self.confirmButton = gtk.Button("Okay") self.confirmButton.show() self.confirmButton.connect("clicked", self.okay) hbox.pack_start(self.confirmButton, True, False) cancelButton = gtk.Button("Cancel") cancelButton.connect("clicked", self.destroy) cancelButton.show() hbox.pack_end(cancelButton, True, False) hbox.show() self.vvbox.pack_start(hbox) self.vvbox.show() self.window.add(self.vvbox) self.onOkay = None self.running = True self.destoryed = False
def __init__(self, tw): """Create and shows the window.""" self.tw = tw # Create top-level window gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_title("Preferences") self.connect("delete_event", self.quit) self.layout = gtk.Table(2, 2, False) self.table = gtk.Table(5, 2, False) self.table.set_row_spacings(5) self.table.set_col_spacings(5) createLabel(self.table, text="Default Font", gridX=0, gridY=0) self.font = gtk.FontButton(self.tw.defaults["font"]) self.font.set_alignment(0, 0.5) self.table.attach(self.font, 1, 2, 0, 1, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND) createLabel(self.table, text="Default Background Color", gridX=0, gridY=1) self.bgColor = gtk.ColorButton(gtk.gdk.color_parse(self.tw.defaults["bgColor"])) self.bgColor.set_alignment(0, 0.5) self.table.attach(self.bgColor, 1, 2, 1, 2, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND) createLabel(self.table, text="Default Foreground Color", gridX=0, gridY=2) self.fgColor = gtk.ColorButton(gtk.gdk.color_parse(self.tw.defaults["fgColor"])) self.fgColor.set_alignment(0, 0.5) self.table.attach(self.fgColor, 1, 2, 2, 3, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND) createLabel(self.table, text="Default Border Color", gridX=0, gridY=3) self.borderColor = gtk.ColorButton(gtk.gdk.color_parse(self.tw.defaults["borderColor"])) self.borderColor.set_alignment(0, 0.5) self.table.attach(self.borderColor, 1, 2, 3, 4, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND) createLabel(self.table, text="Number of background styles", gridX=0, gridY=4) self.bgCount = createEntry(self.table, maxSize=6, width=8, text=str(self.tw.defaults["bgCount"]), gridX=1, gridY=4, xExpand=True, yExpand=True) self.layout.attach(self.table, 0, 2, 0, 1, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND, xpadding=20, ypadding=5) createButton(self.layout, text="Save", stock=gtk.STOCK_SAVE, name="save", gridX=0, gridY=1, xExpand=True, yExpand=True, handler=self.save) createButton(self.layout, text="Cancel", stock=gtk.STOCK_CANCEL, name="cancel", gridX=1, gridY=1, xExpand=True, yExpand=True, handler=self.quit) self.add(self.layout) self.show_all()
def createSystemTrayWidgets(self): """Create the System Tray widgets.""" self.tableTray = gtk.Table(rows=9, columns=3, homogeneous=False) self.tableTray.set_row_spacings(5) self.tableTray.set_col_spacings(5) createLabel(self.tableTray, text="Show System Tray", gridX=0, gridY=0, xPadding=10) self.trayShow = createCheckButton(self.tableTray, active=True, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("systray", self.trayShow) createLabel(self.tableTray, text="Padding (x, y)", gridX=0, gridY=1, xPadding=10) self.trayPadX = createEntry(self.tableTray, maxSize=6, width=8, text=TRAY_PADDING_X, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.trayPadY = createEntry(self.tableTray, maxSize=6, width=8, text=TRAY_PADDING_Y, gridX=2, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTray, text="Horizontal Spacing", gridX=0, gridY=2, xPadding=10) self.traySpacing = createEntry(self.tableTray, maxSize=6, width=8, text=TRAY_SPACING, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("systray_padding", (self.trayPadX, self.trayPadY, self.traySpacing)) createLabel(self.tableTray, text="System Tray Background ID", gridX=0, gridY=3, xPadding=10) self.trayBg = createComboBox(self.tableTray, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=3, handler=self.changeOccurred) self.registerComponent("systray_background_id", self.trayBg) createLabel(self.tableTray, text="Icon Ordering", gridX=0, gridY=4, xPadding=10) self.trayOrder = createComboBox(self.tableTray, ["ascending", "descending", "left2right", "right2left"], gridX=1, gridY=4, handler=self.changeOccurred) self.registerComponent("systray_sort", self.trayOrder) createLabel(self.tableTray, text="Maximum Icon Size (0 for automatic size)", gridX=0, gridY=5, xPadding=10) self.trayMaxIconSize = createEntry(self.tableTray, maxSize=6, width=8, text=TRAY_MAX_ICON_SIZE, gridX=1, gridY=5, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("systray_icon_size", self.trayMaxIconSize) createLabel(self.tableTray, text="System Tray Icon Alpha (0 to 100)", gridX=0, gridY=6, xPadding=10) self.trayIconHue = createEntry(self.tableTray, maxSize=6, width=8, text=TRAY_ICON_ALPHA, gridX=1, gridY=6, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTray, text="System Tray Icon Saturation (-100 to 100)", gridX=0, gridY=7, xPadding=10) self.trayIconSat = createEntry(self.tableTray, maxSize=6, width=8, text=TRAY_ICON_SAT, gridX=1, gridY=7, xExpand=True, yExpand=False, handler=self.changeOccurred) # Note: added below createLabel(self.tableTray, text="System Tray Icon Brightness (-100 to 100)", gridX=0, gridY=8, xPadding=10) self.trayIconBri = createEntry(self.tableTray, maxSize=6, width=8, text=TRAY_ICON_BRI, gridX=1, gridY=8, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("systray_icon_asb", (self.trayIconHue, self.trayIconSat, self.trayIconBri))
def createClockSettingsWidgets(self): """Create the Clock Settings widgets.""" self.tableClockSettings = gtk.Table(rows=3, columns=3, homogeneous=False) self.tableClockSettings.set_row_spacings(5) self.tableClockSettings.set_col_spacings(5) createLabel(self.tableClockSettings, text="Clock Font Color", gridX=0, gridY=0, xPadding=10) self.clockFontCol = createEntry(self.tableClockSettings, maxSize=7, width=9, text="", gridX=1, gridY=0, xExpand=True, yExpand=False, handler=None, name="clockFontCol") self.clockFontCol.connect("activate", self.colorTyped) self.clockFontColButton = createColorButton(self.tableClockSettings, color=self.defaults["fgColor"], useAlpha=True, name="clockFontCol", gridX=2, gridY=0, handler=self.colorChange) self.clockFontCol.set_text(self.defaults["fgColor"]) # Add this AFTER we set color to avoid "changed" event self.clockFontCol.connect("changed", self.changeOccurred) self.registerComponent("clock_font_color", (self.clockFontCol, self.clockFontColButton)) createLabel(self.tableClockSettings, text="Padding (x, y)", gridX=0, gridY=1, xPadding=10) self.clockPadX = createEntry(self.tableClockSettings, maxSize=6, width=8, text=CLOCK_PADDING_X, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.clockPadY = createEntry(self.tableClockSettings, maxSize=6, width=8, text=CLOCK_PADDING_Y, gridX=2, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("clock_padding", (self.clockPadX, self.clockPadY)) createLabel(self.tableClockSettings, text="Clock Background ID", gridX=0, gridY=2, xPadding=10) self.clockBg = createComboBox(self.tableClockSettings, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=2, handler=self.changeOccurred) self.registerComponent("clock_background_id", self.clockBg) createLabel(self.tableClockSettings, text="Left Click Command", gridX=0, gridY=3, xPadding=10) self.clockLClick = createEntry(self.tableClockSettings, maxSize=50, width=20, text=CLOCK_LCLICK, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("clock_lclick_command", self.clockLClick) createLabel(self.tableClockSettings, text="Right Click Command", gridX=0, gridY=4, xPadding=10) self.clockRClick = createEntry(self.tableClockSettings, maxSize=50, width=20, text=CLOCK_RCLICK, gridX=1, gridY=4, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("clock_rclick_command", self.clockRClick) createLabel(self.tableClockSettings, text="Time 1 Timezone", gridX=0, gridY=5, xPadding=10) self.clockTime1Timezone = createEntry(self.tableClockSettings, maxSize=50, width=20, text=CLOCK_TIME1_TIMEZONE, gridX=1, gridY=5, xExpand=True, yExpand=False, handler=self.changeOccurred) self.clockTimezone1CheckButton = createCheckButton(self.tableClockSettings, text="Enable", active=False, gridX=2, gridY=5, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("time1_timezone", self.clockTime1Timezone) createLabel(self.tableClockSettings, text="Time 2 Timezone", gridX=0, gridY=6, xPadding=10) self.clockTime2Timezone = createEntry(self.tableClockSettings, maxSize=50, width=20, text=CLOCK_TIME2_TIMEZONE, gridX=1, gridY=6, xExpand=True, yExpand=False, handler=self.changeOccurred) self.clockTimezone2CheckButton = createCheckButton(self.tableClockSettings, text="Enable", active=False, gridX=2, gridY=6, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("time2_timezone", self.clockTime2Timezone) createLabel(self.tableClockSettings, text="Tooltip Timezone", gridX=0, gridY=7, xPadding=10) self.clockTooltipTimezone = createEntry(self.tableClockSettings, maxSize=50, width=20, text=CLOCK_TOOLTIP_TIMEZONE, gridX=1, gridY=7, xExpand=True, yExpand=False, handler=self.changeOccurred) self.clockTimezoneTooltipCheckButton = createCheckButton(self.tableClockSettings, text="Enable", active=False, gridX=2, gridY=7, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("clock_tooltip_timezone", self.clockTooltipTimezone)
def createBatteryWidgets(self): """Creates the Battery widgets.""" self.tableBattery = gtk.Table(rows=8, columns=3, homogeneous=False) self.tableBattery.set_row_spacings(5) self.tableBattery.set_col_spacings(5) createLabel(self.tableBattery, text="Show Battery Applet", gridX=0, gridY=0, xPadding=10) self.batteryCheckButton = createCheckButton(self.tableBattery, active=False, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("battery", self.batteryCheckButton) createLabel(self.tableBattery, text="Battery Low Status (%)", gridX=0, gridY=1, xPadding=10) self.batteryLow = createEntry(self.tableBattery, maxSize=6, width=8, text=BATTERY_LOW, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("battery_low_status", self.batteryLow) createLabel(self.tableBattery, text="Battery Low Action", gridX=0, gridY=2, xPadding=10) self.batteryLowAction = createEntry(self.tableBattery, maxSize=150, width=32, text=BATTERY_ACTION, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("battery_low_cmd", self.batteryLowAction) createLabel(self.tableBattery, text="Battery Hide (0 to 100)", gridX=0, gridY=3, xPadding=10) self.batteryHide = createEntry(self.tableBattery, maxSize=6, width=8, text=BATTERY_HIDE, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("battery_hide", self.batteryHide) createLabel(self.tableBattery, text="Battery 1 Font", gridX=0, gridY=4, xPadding=10) self.bat1FontButton = createFontButton(self.tableBattery, font=self.defaults["font"], gridX=1, gridY=4, handler=self.changeOccurred) self.registerComponent("bat1_font", self.bat1FontButton) createLabel(self.tableBattery, text="Battery 2 Font", gridX=0, gridY=5, xPadding=10) self.bat2FontButton = createFontButton(self.tableBattery, font=self.defaults["font"], gridX=1, gridY=5, handler=self.changeOccurred) self.registerComponent("bat2_font", self.bat2FontButton) createLabel(self.tableBattery, text="Battery Font Color", gridX=0, gridY=6, xPadding=10) self.batteryFontCol = createEntry(self.tableBattery, maxSize=7, width=9, text="", gridX=1, gridY=6, xExpand=True, yExpand=False, handler=None, name="batteryFontCol") self.batteryFontCol.connect("activate", self.colorTyped) self.batteryFontColButton = createColorButton(self.tableBattery, color=self.defaults["fgColor"], useAlpha=True, name="batteryFontCol", gridX=2, gridY=6, handler=self.colorChange) self.batteryFontCol.set_text(self.defaults["fgColor"]) # Add this AFTER we set color to avoid "changed" event self.batteryFontCol.connect("changed", self.changeOccurred) self.registerComponent("battery_font_color", (self.batteryFontCol, self.batteryFontColButton)) createLabel(self.tableBattery, text="Padding (x, y)", gridX=0, gridY=7, xPadding=10) self.batteryPadX = createEntry(self.tableBattery, maxSize=6, width=8, text=BATTERY_PADDING_X, gridX=1, gridY=7, xExpand=True, yExpand=False, handler=self.changeOccurred) self.batteryPadY = createEntry(self.tableBattery, maxSize=6, width=8, text=BATTERY_PADDING_Y, gridX=2, gridY=7, xExpand=True, yExpand=False, handler=self.changeOccurred) self.registerComponent("battery_padding", (self.batteryPadX, self.batteryPadY)) createLabel(self.tableBattery, text="Battery Background ID", gridX=0, gridY=8, xPadding=10) self.batteryBg = createComboBox(self.tableBattery, ["0 (fully transparent)"] + range(1, len(self.bgs)), gridX=1, gridY=8, handler=self.changeOccurred) self.registerComponent("battery_background_id", self.batteryBg)
def _create_legend(self): icons = ( (gtk.STOCK_FILE, 'Class'), (gtk.STOCK_EXECUTE, 'Method'), (gtk.STOCK_SELECT_FONT, 'Field'), (gtk.STOCK_DELETE, 'Declaration not found'), (gtk.STOCK_INFO, 'Miscellaneous (info)'), (u'?', 'Direct call – e.g. static, private, etc'), (u'?', 'Virtual call (? + ?)'), (u'?', 'Virtual call (indirect) which could be performed because ' 'of polymorphism'), (u'?', 'Virtual call (direct only) which does not actually ' 'performed – e.g. interface method'), (u'?', 'Super call (? + ?)'), (u'?', 'Super call (indirect) because direct super does not ' 'declare the method'), (u'?', 'Super call (direct only) which does not actually ' 'performed – e.g. not declared here'), ) table = gtk.Table(7, 5) table.set_border_width(8) table.set_row_spacings(8) table.set_col_spacings(8) separator = gtk.VSeparator() table.attach(separator, 2, 3, 0, 7, 0) x, y = 0, 0 for icon, desc in icons: if len(icon) == 1: image = gtk.Label(icon) else: image = gtk.Image() image.set_from_stock(icon, gtk.ICON_SIZE_MENU) image.set_alignment(1, 0.5) label = gtk.Label(desc) label.set_alignment(0, 0.5) table.attach(image, x + 0, x + 1, y, y + 1, gtk.FILL) table.attach(label, x + 1, x + 2, y, y + 1, gtk.FILL) y += 1 if y == 5 and x == 0: x, y = 3, 0 frame = gtk.Frame('Legend') frame.add(table) return frame