def createMountPointCombo(request, excludeMountPoints=[]): mountCombo = gtk.Combo() mntptlist = [] if request.type != REQUEST_NEW and request.fslabel: mntptlist.append(request.fslabel) for p in defaultMountPoints: if p in excludeMountPoints: continue if not p in mntptlist and (p[0] == "/"): mntptlist.append(p) mountCombo.set_popdown_strings (mntptlist) mountpoint = request.mountpoint if request.fstype and request.fstype.isMountable(): mountCombo.set_sensitive(1) if mountpoint: mountCombo.entry.set_text(mountpoint) else: mountCombo.entry.set_text("") else: mountCombo.entry.set_text(_("<Not Applicable>")) mountCombo.set_sensitive(0) mountCombo.set_data("saved_mntpt", None) return mountCombo
def frame1(self): frame = gtk.Frame(_("Base config")) frame.set_border_width(5) table = gtk.Table(rows=2, columns=5, homogeneous=gtk.FALSE) table.set_border_width(5) table.set_col_spacings(5) frame.add(table) lbl = gtk.Label(_("Device")) lbl.set_alignment(xalign=0.0, yalign=0.5) table.attach(lbl, 0, 1, 0, 1) self.g_device = gtk.Entry() table.attach(self.g_device, 1, 2, 0, 1) lbl = gtk.Label(_("Skin")) lbl.set_alignment(xalign=0.0, yalign=0.5) table.attach(lbl, 0, 1, 1, 2) self.g_skin = gtk.Combo() self.fill_combo() table.attach(self.g_skin, 1, 2, 1, 2) self.g_start_muted = gtk.CheckButton(_("Start muted")) table.attach(self.g_start_muted, 0, 2, 2, 3) self.g_dont_quit = gtk.CheckButton(_("Don't quit mode")) table.attach(self.g_dont_quit, 0, 2, 3, 4) return frame
def widgts(self, widget, entry): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title("pyGTK additional WIDGETS") window.set_size_request(200, 200) window.connect("delete_event", gtk.main_quit) vbox = gtk.VBox() window.add(vbox) vbox.show() chkbutton = gtk.CheckButton("click to activate") chkbutton.connect("toggled", self.call_back, "click to activate") rdiobutton1 = gtk.RadioButton(None, "Switch me1") rdiobutton1.connect("toggled", self.call_back, "Switch me1") rdiobutton2 = gtk.RadioButton(rdiobutton1, "Switch me2") rdiobutton2.connect("toggled", self.call_back, "Switch me2") combobox = gtk.Combo() slist = ["pyGTK", "pyQT", "Tkinter", "pyGame"] combobox.set_popdown_strings(slist) combobox.set_use_arrows(True) combobox.entry.connect("activate", self.prntxt) vbox.pack_start(chkbutton) vbox.pack_start(rdiobutton1) vbox.pack_start(rdiobutton2) vbox.pack_start(combobox) chkbutton.show() rdiobutton1.show() rdiobutton2.show() combobox.show() window.show()
def show(self): if self.select_resource: self.__cboResource = gtk.Combo() self.__cboResource.set_usize(100, 0) self.__hboxPJ.pack_end(self.__cboResource) self.__cboResource.show() ## Call our base gtk.EventBox.show(self)
def __init__(self, title, callback, data): gtk.Dialog.__init__(self, title, commonui.mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL, (gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) self.callback = callback self.data = data self.connect("response", self.responseSignal) table = gtk.Table(2, 3) commentLabel = gtk.Label( _("Describe the device that you would like to configure.")) commentLabel.set_line_wrap(True) commentLabel.show() table.attach(commentLabel, 0, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.EXPAND, 10, 5) screenLabel = gtk.Label(_("Screen Number")) screenLabel.show() table.attach(screenLabel, 0, 1, 1, 2, 0, gtk.EXPAND, 10, 5) self.screenCombo = gtk.Combo() self.screenCombo.set_popdown_strings( [""] + map(str, range(len(commonui.dpy.screens)))) self.screenCombo.entry.connect("activate", self.screenSignal) self.screenCombo.list.connect("select_child", self.screenSignal) self.screenCombo.show() table.attach(self.screenCombo, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.EXPAND, 10, 5) driverLabel = gtk.Label(_("Driver Name")) driverLabel.show() table.attach(driverLabel, 0, 1, 2, 3, 0, gtk.EXPAND, 10, 5) self.driverCombo = gtk.Combo() self.driverCombo.set_popdown_strings( [""] + [str(driver.name) for driver in dri.DisplayInfo.drivers.values()]) self.driverCombo.show() table.attach(self.driverCombo, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.EXPAND, 10, 5) if data and data.__class__ == dri.DeviceConfig: if data.screen: self.screenCombo.entry.set_text(data.screen) if data.driver: self.driverCombo.entry.set_text(data.driver) table.show() self.vbox.pack_start(table, True, True, 5) self.show()
def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_size_request(600, 400) self.Mainbox = gtk.HBox(spacing=3) self.add(self.Mainbox) self.thirdbox = gtk.VBox(spacing=3) self.Mainbox.pack_start(self.thirdbox, True, True, 5) self.Ncard = gtk.HBox(spacing=3) self.thirdbox.pack_start(self.Ncard, True, True, 5) self.label = gtk.Label("Network Card") self.Ncard.pack_start(self.label, True, True, 5) self.entry = gtk.Combo() self.entry.set_popdown_strings(devlist) self.entry.entry.connect("changed", self.getifinfo) self.entry.entry.set_text("Choose Network Card") self.Ncard.pack_start(self.entry, True, True, 5) self.sbtn = gtk.Button(label="Use this") self.sbtn.connect("clicked", self.on_sbtn_click) self.Ncard.pack_start(self.sbtn, True, True, 5) self.ifinfo = gtk.HBox(spacing=3) self.thirdbox.pack_start(self.ifinfo, True, True, 5) self.iplbl = gtk.Label("ip : 0.0.0.0") self.ifinfo.pack_start(self.iplbl, True, True, 5) self.netmlbl = gtk.Label("netmask : 0.0.0.0") self.ifinfo.pack_start(self.netmlbl, True, True, 5) self.glbl = gtk.Label("gateway : 0.0.0.0") self.ifinfo.pack_start(self.glbl, True, True, 5) self.spbtn = gtk.Button(label="Act like selected") self.spbtn.connect("clicked", self.on_spbtn_click) self.ifinfo.pack_start(self.spbtn, True, True, 5) self.table = gtk.ScrolledWindow() self.table.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.thirdbox.pack_start(self.table, True, True, 5) self.treestore = gtk.ListStore(int, str, str) self.treeview = gtk.TreeView(self.treestore) self.cell = gtk.CellRendererText() self.tvcolumn = gtk.TreeViewColumn('Num', self.cell, text=0) self.treeview.append_column(self.tvcolumn) self.tvcolumn.set_sort_column_id(0) self.cell1 = gtk.CellRendererText() self.tvcolumn1 = gtk.TreeViewColumn('IP Address', self.cell1, text=1) self.treeview.append_column(self.tvcolumn1) self.tvcolumn1.set_sort_column_id(1) self.cell2 = gtk.CellRendererText() self.tvcolumn2 = gtk.TreeViewColumn('Mac Address', self.cell2, text=2) self.treeview.append_column(self.tvcolumn2) self.tvcolumn2.set_sort_column_id(2) self.table.add(self.treeview) self.statelbl = gtk.Label("Choose Network Card") self.thirdbox.pack_start(self.statelbl, True, True, 5) self.intsplbl = gtk.Label("") self.thirdbox.pack_start(self.intsplbl, True, True, 5)
def window_change(self, widget=None, data=None): menu = self.editTree.get_widget("actionTypeMenu") name = menu.get_children()[0].get() args = lb.program_action_type[name][1] l = len(args) table = self.editTree.get_widget("table") for c in table.get_children(): table.remove(c) table.resize(2, l) self.entryWidgets = [] for x in range(0, l): label = gtk.Label(args[x][0]) label.set_alignment(1.0, 0.5) label.show() table.attach(label, 0, 1, x, x + 1, xoptions=FILL, yoptions=0) value = args[x][1] if callable(value): value = value() if type(value) == type([]): entry = gtk.Combo() entry.set_use_arrows(1) entry.set_case_sensitive(0) entry.entry.set_editable(0) count = 0 current = 0 menuitems = [] for v in value: try: if v == data[args[x][0]]: current = count except: pass menuitems.append(v) count = count + 1 entry.set_popdown_strings(menuitems) entry.entry.set_text(value[current]) if type(value) == type(''): entry = gtk.Entry() current = '' try: current = data[args[x][0]] except: pass entry.set_text(current) entry.show_all() align = gtk.Alignment(0.0, 0.5, 0.0, 0.0) align.add(entry) align.show() self.entryWidgets.append(entry) table.attach(align, 1, 2, x, x + 1, xoptions=FILL, yoptions=0)
def __init__(self, parent): self.value = None self.dialog = gtk.Dialog( "Select a package", parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, None) combo = gtk.Combo() combo.entry.set_text('') dict = pkglist.fastload() combotext = [] for key in dict.keys(): if not dict[key] in combotext: combotext.append(dict[key]) # + ' --- ' + key ) combo.set_popdown_strings(combotext) combo.show() self.dialog.vbox.pack_start(combo) btnok = gtk.Button('OK') self.dialog.action_area.pack_start(btnok, True, True, 0) def okcallback(widget, args): self.value = combo.entry.get_text() self.dialog.destroy() btnok.connect('clicked', okcallback, None) btnok.show() btncan = gtk.Button('Cancel') self.dialog.action_area.pack_start(btncan, True, True, 0) def cancallback(widget, args): self.value = None self.dialog.destroy() btncan.connect('clicked', cancallback, None) btncan.show()
def __init__(self): self.history = [] self.window = gtk.Window() self.label = gtk.Label("Run...") self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) self.window.set_border_width(10) self.window.set_title("Run...") self.button = gtk.Button("Launch") self.button.connect("clicked", self.run_it) self.cancel = gtk.Button("Cancel") self.cancel.connect("clicked", self.destroy) self.combo = gtk.Combo() self.combo.entry.set_text('') self.combo.set_size_request(200, 25) self.combo.entry.connect("activate", self.run_it) self.history = self.read_history() self.combo.set_popdown_strings(self.history) topbox = gtk.HBox(gtk.FALSE, 0) botbox = gtk.HBox(gtk.FALSE, 0) fullbox = gtk.VBox(gtk.FALSE, 0) topbox.pack_start(self.label, gtk.FALSE, gtk.FALSE, 0) botbox.pack_start(self.combo, gtk.FALSE, gtk.FALSE, 0) botbox.pack_start(self.button, gtk.FALSE, gtk.FALSE, 0) botbox.pack_start(self.cancel, gtk.FALSE, gtk.FALSE, 0) fullbox.pack_start(topbox, gtk.FALSE, gtk.FALSE, 0) fullbox.pack_start(botbox, gtk.FALSE, gtk.FALSE, 0) self.combo.show() self.button.show() self.cancel.show() self.label.show() topbox.show() botbox.show() fullbox.show() self.window.add(fullbox) self.window.show()
def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) #Creating a Window self.window.set_size_request(400, 300) self.window.set_title( "Text-Box Window") #Setting the title of the Window self.window.connect("delete_event", lambda w, e: gtk.main_quit()) self.hbox = gtk.VBox(True, 20) #Adding a Horizontal Box self.window.add(self.hbox) self.hbox.show() self.hbox1 = gtk.HBox(True, 20) #Adding a Horizontal Box self.window.add(self.hbox1) self.hbox1.show() self.textbox = gtk.Entry() #Creating the textbox self.textbox.set_max_length( 20 ) #Setting the maximum length of input string to be entered in the textbox self.textbox.connect("activate", self.sample, self.textbox) self.textbox.set_text( "type the text here") #Default String to be displayed self.textbox.select_region(0, len(self.textbox.get_text())) self.hbox.pack_start(self.textbox, True, True, 0) self.textbox.show() self.button1 = gtk.CheckButton("checkbutton") self.button1.connect("toggled", self.check, "checkbutton") self.hbox.pack_start(self.button1, True, True, 2) self.button1.show() self.button2 = gtk.RadioButton(None, "radio button1") self.button2.connect("toggled", self.check, "radiobutton1") self.hbox.pack_start(self.button2, True, True, 0) self.button2.show() self.button3 = gtk.RadioButton(self.button2, "radio button2") self.button3.connect("toggled", self.check, "radiobutton2") self.hbox.pack_start(self.button3, True, True, 0) self.button3.show() self.combo = gtk.Combo() sdf = "enter the contents of the list" self.combo.entry.set_text(sdf) slist = ["string1", "String 2", "String 3"] self.combo.set_popdown_strings(slist) self.hbox.pack_start(self.combo, True, True, 0) self.combo.show() self.button = gtk.Button(stock=gtk.STOCK_OK) #Creating the Button self.button.connect( "clicked", self.callback, "OK" ) #Setting the Stock to "OK" and specifying to call the function Callback when the button is pressed self.hbox.pack_start(self.button, True, True, 0) self.button.set_flags(gtk.CAN_DEFAULT) self.button.grab_default() self.button.show() self.window.show() #Displaying the Window
def widgetFactory(self, *args, **kws): return gtk.Combo()
def __init__(self): self.panel = {} self.step_completed = 0 self.labels = [] self.ppu = 1.0 self.idle_id = None self.window = gtk.Window() self.window.connect('destroy', mainquit) self.window.set_title('Geocomp') self.window.set_border_width(10) self.out_vbox = gtk.VBox() self.window.add(self.out_vbox) self.extra_label = gtk.Label('----------') self.out_vbox.pack_end(self.extra_label, expand=FALSE) self.main_hbox = gtk.HBox() self.out_vbox.pack_start(self.main_hbox) self.canvas_vbox = gtk.VBox() self.main_hbox.pack_end(self.canvas_vbox) ha = gtk.Adjustment(0, 0, 1000, 40, 100, 100) va = gtk.Adjustment(0, 0, 1000, 40, 100, 100) self.scroll = gtk.ScrolledWindow(ha, va) self.canvas_vbox.pack_start(self.scroll) #self.canvas = gnome.Canvas (aa=TRUE) self.canvas = Canvas(aa=FALSE) self.canvas.set_usize(config.WIDTH, config.HEIGHT) self.canvas.set_scroll_region(0, 0, config.WIDTH, config.HEIGHT) self.scroll.add(self.canvas) self.controls_box = gtk.HBox() self.canvas_vbox.pack_end(self.controls_box, expand=FALSE) self.dyn_controls_box = gtk.HBox() self.controls_box.pack_start(self.dyn_controls_box) self.delay = gtk.SpinButton(gtk.Adjustment(config.DELAY, 0, config.MAX_DELAY, 10, config.MAX_DELAY / 10, config.MAX_DELAY / 10), digits=0, climb_rate=10) self.delay.set_numeric(TRUE) self.dyn_controls_box.pack_start( self.delay) #, expand=TRUE, fill=FALSE) self.step = gtk.CheckButton('passo a passo') self.step.set_state(TRUE) self.step.connect_after('clicked', self.step_clicked) self.dyn_controls_box.pack_start(self.step, fill=FALSE) self.zoom_in = gtk.Button('+') self.zoom_out = gtk.Button('-') #self.zoom_box = gtk.HBox () #self.canvas_vbox.pack_start (self.zoom_box) self.dyn_controls_box.pack_start(self.zoom_in) self.dyn_controls_box.pack_start(self.zoom_out) self.zoom_in.connect('clicked', self.zoom, 1.5) self.zoom_out.connect('clicked', self.zoom, 2.0 / 3.0) self.hide = gtk.CheckButton('esconder') self.hide.set_state(TRUE) self.controls_box.pack_start(self.hide, fill=FALSE) geocomp.init_display(gnome, self) self.left_box = gtk.VBox() self.left_box.set_border_width(5) self.main_hbox.pack_start(self.left_box, expand=FALSE) self.file_box = gtk.VBox() self.left_box.pack_start(self.file_box) self.files_combo = gtk.Combo() self.handler_id = self.files_combo.entry.connect( "changed", self.open_file) #self.handler_id = self.files_combo.list.connect ("selection_changed", self.open_file) self.files_combo.set_value_in_list(val=TRUE, ok_if_empty=FALSE) self.files_combo.disable_activate() self.files_combo.entry.set_editable(FALSE) self.file_box.pack_start(self.files_combo, expand=FALSE) self.create_buttons(None, (geocomp, None)) self.window.show_all() style = self.canvas.get_style() style.bg[STATE_NORMAL] = style.black self.update_files(config.DATADIR, 1) self.files_combo.entry.emit("changed") self.window.add_events(gtk.gdk.KEY_RELEASE)
# but I cannot see a better way but iterating over all of the menu items, which is even worse. (Ofer Waldman) menubar.get_children()[0].get_submenu().get_children()[1].set_active( configuration.automatic_translation ) table.attach(menubar, 0, 2, 0, 1, gtk.EXPAND|gtk.FILL, 0) #word = gtk.Entry() word = gtk.TextView() # the textview instead of entry is needed to allow messing with the PRIMARY clipboard. word.set_size_request(420, -1) word.get_buffer().set_text("מילה") table.attach(word, 0, 1, 1, 2, gtk.EXPAND|gtk.FILL, 0) trans = gtk.Button("תרגם") trans.set_size_request(70, -1) table.attach(trans, 1, 2, 1, 2, 0, 0) combo = gtk.Combo() combo.set_size_request(420, -1) table.attach(combo, 0, 1, 2, 3, gtk.EXPAND|gtk.FILL, 0) select = gtk.Button("בחר") select.set_size_request(70, -1) table.attach(select, 1, 2, 2, 3, 0, 0) translation = gtk.TextBuffer() translation_textview = gtk.TextView(translation) translation_textview.set_wrap_mode(gtk.WRAP_WORD) translation_textview.set_editable(False)
def __init__(self, parent, drvname=None): self.classes = None self.src = None self.dst = None self.drvname = drvname self.file = None self.ident = None self.perm = None self.policy = None self.priv = None self.value = True self.dialog = gtk.Dialog( "Add_drv arguments", parent, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, None) table = gtk.Table(9, 7, True) def bindarg(lbl, ent, count): ent.select_region(0, len(ent.get_text())) lbl.show() ent.show() table.attach(lbl, 1, 2, count, count + 1) table.attach(ent, 3, 6, count, count + 1) lbl_drv = gtk.Label("driver_name") ent_drv = gtk.Entry() bindarg(lbl_drv, ent_drv, 0) if self.drvname: ent_drv.set_text(self.drvname) lbl_src = gtk.Label("source_dir") ent_src = gtk.Entry() bindarg(lbl_src, ent_src, 1) lbl_dst = gtk.Label("destination_dir") cmb_dst = gtk.Combo() cmb_dst.entry.set_text('') import Driver combotext = Driver.getDrvList() cmb_dst.set_popdown_strings(combotext) lbl_dst.show() cmb_dst.show() table.attach(lbl_dst, 1, 2, 2, 3) table.attach(cmb_dst, 3, 6, 2, 3) lbl_filel = gtk.Label("file list") ent_filel = gtk.Entry() bindarg(lbl_filel, ent_filel, 3) lbl_class = gtk.Label("class_name") ent_class = gtk.Entry() bindarg(lbl_class, ent_class, 4) lbl_ident = gtk.Label("identify_name") ent_ident = gtk.Entry() bindarg(lbl_ident, ent_ident, 5) lbl_permi = gtk.Label("permission") ent_permi = gtk.Entry() bindarg(lbl_permi, ent_permi, 6) lbl_polic = gtk.Label("policy") ent_polic = gtk.Entry() bindarg(lbl_polic, ent_polic, 7) lbl_privi = gtk.Label("privilege") ent_privi = gtk.Entry() bindarg(lbl_privi, ent_privi, 8) table.show() self.dialog.vbox.pack_start(table) btnok = gtk.Button('OK') self.dialog.action_area.pack_start(btnok, True, True, 0) def okcallback(widget, args): self.value = True self.drv = ent_drv.get_text() self.src = ent_src.get_text() self.dst = cmb_dst.entry.get_text() self.file = ent_filel.get_text().split(';') self.classes = ent_class.get_text() self.ident = ent_ident.get_text() self.perm = ent_permi.get_text() self.policy = ent_polic.get_text() self.priv = ent_privi.get_text() self.dialog.destroy() btnok.connect('clicked', okcallback, None) btnok.show() btncan = gtk.Button('Cancel') self.dialog.action_area.pack_start(btncan, True, True, 0) def cancallback(widget, args): self.value = False self.drv = None self.src = None self.dst = None self.file = None self.classes = None self.ident = None self.perm = None self.policy = None self.priv = None self.dialog.destroy() btncan.connect('clicked', cancallback, None) btncan.show()
def __init__(self): # create a new window self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(5) self.window.set_size_request(500, 500) self.window.set_title("Benzetacil GTK v01") self.window.connect("delete_event", lambda w, e: gtk.main_quit()) #Creo la tabla self.table = gtk.Table(10, 10, True) #Creo el lable URL self.label1 = gtk.Label("URL:") #Creo la caja de texto para la URL self.url = gtk.Entry() self.url.set_max_length(100) self.url.connect("activate", self.enter_callback, self.url) self.url.set_text("http://127.0.0.1/blindSQL/index.php?id_n=2") self.url.select_region(0, len(self.url.get_text())) #Creo la caja de texto para el output self.salida = gtk.TextView() self.salida.set_property('editable', False) self.buffer = self.salida.get_buffer() #Creo el boton conectar self.buttonRun = gtk.Button("Run") self.buttonRun.connect("clicked", self.conectar) #Creo el boton de sacar Tabla self.buttonST = gtk.Button("Tablas") self.buttonST.connect("clicked", self.conectarTablas) #Creo el boton de sacar Registros self.buttonSR = gtk.Button("Registros") self.buttonSR.connect("clicked", self.conectarRegistro) #creo un separador self.separator = gtk.HSeparator() #Creo un boton de exit self.buttonQuit = gtk.Button(stock=gtk.STOCK_CLOSE) self.buttonQuit.connect("clicked", lambda w: gtk.main_quit()) #agrego el combo para econtrar errores self.combo = gtk.Combo() slist = ["Compara fuentes", "Busca Patron"] self.combo.set_popdown_strings(slist) #agrego el combo para el methodo self.comboM = gtk.Combo() mlist = ["GET", "POST"] self.comboM.set_popdown_strings(mlist) #creo un scroll window en un pack verticl scrolled_window = gtk.ScrolledWindow() scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.vbox = gtk.VBox(False, 1) self.vbox.pack_start(scrolled_window, gtk.TRUE, gtk.TRUE, 0) scrolled_window.add_with_viewport(self.salida) #agrego los widgets self.window.add(self.table) self.table.attach(self.label1, 0, 1, 0, 1) self.table.attach(self.url, 1, 9, 0, 1) self.table.attach(self.buttonRun, 9, 10, 0, 1) self.table.attach(self.combo, 0, 3, 1, 2) self.table.attach(self.comboM, 3, 5, 1, 2) self.table.attach(self.buttonST, 6, 7, 1, 2) self.table.attach(self.buttonSR, 7, 8, 1, 2) self.table.attach(self.separator, 0, 10, 2, 3) self.table.attach(self.vbox, 0, 10, 3, 9) self.table.attach(self.buttonQuit, 0, 2, 9, 10) #muestrando self.window.show_all()
def __init__(self,cwd,base_dir,monitor,filename,exstatus,exefile=None): try: infile = open(filename, 'rb') except: print sys.exit("Error: file cannot be opened") b=infile.read(6) b=infile.read(4) b=infile.read(6) wsAnaFlag=0 if b=="wsAna\0": wsAnaFlag=1 infile.close() #print "wsAnaFlag=%d" % wsAnaFlag # [Define the constructor variables] self._wsAnaFlag = wsAnaFlag self._widget = None self._status = None self._image = None self._combo = None self._thr = "" self._hbox = None self._topN = "" self._mode = "TopN" self._filename = filename if wsAnaFlag==1: #print "hoge" self._mem = "1" self._ins = "0" self._cycle = "0" self._cpi = "0" self._bpi = "0" self._bpc = "0" self._ibf = "0" self._flop = "0" self._dependency = "0" self._eqTHR = "0" self._memRW = "0" self._wsPage = "1" self._wsRead = "1" self._wsWrite = "1" else: self._mem = "1" self._ins = "1" self._cycle = "0" self._cpi = "0" self._bpi = "0" self._bpc = "0" self._ibf = "0" self._flop = "1" self._dependency = "0" self._eqTHR = "0" self._memRW = "0" self._wsPage = "0" self._wsRead = "0" self._wsWrite = "0" #print self._wsPage print self._filename.replace(cwd,"") if (self._filename.replace(cwd,"") == "/lcct.dat"): self._dep = "0" else: self._dep = "1" #print self._dep self._initial = "0" self._hbox_Scaled = gtk.HBox() self._hbox_UnScaled = gtk.HBox() self._base_DIR = base_dir self._CWD = cwd self._SCR = "UNINTERACTIVE" self._monitor = monitor self._exefile = exefile self._exstatus = exstatus #'0' for cycleCnt mode & '1' for instCnt mode # print 'filename',self._filename #print 'exstatus', self._exstatus #print "execfile name",self._exefile # print 'Base directory: ', self._base_DIR #print 'Current directory: ', self._CWD # [Define the vertical box for the display window and add the show option for display] vbox = gtk.VBox() vbox.show() # [Add the vbox container in widget] self._widget = vbox # [Define the horizontal box for the display window and add the show option for display] self._hbox = gtk.HBox() self._hbox.show() # [Add the hbox container in the vertical box] vbox.pack_start(self._hbox,0,0) # [Define the gtk scrolledwindow method for displaying the scrolled window] self.Scrolled_Window = gtk.ScrolledWindow() self.Scrolled_Window.show() # [Read the genenrated svg file into the pixbuf] pixbuf = gtk.gdk.pixbuf_new_from_file( self._CWD + "/lcctm.png") # [Define the image container to hold the image for display] self._image = gtk.Image() ###self._image.set_from_pixbuf(scaled_buf) self._image.set_from_pixbuf(pixbuf) # [Add the image container with the scrolled_window variable to show the image] self.Scrolled_Window.add_with_viewport(self._image) self._image.show() # [Vertical box container ends with the scrolled_window variable] vbox.pack_end(self.Scrolled_Window,True, True, 8) # [Create frame for create a separate part for dynamic inputs and add the frame with the vbox] frame = gtk.Frame("Change of Threshold & TopN") frame.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("RED")) frame.show() colorbox = gtk.EventBox() colorbox.add(frame) colorbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("GREEN")) colorbox.show() vbox.pack_start(colorbox,0,0) # [Create a new horizontal box for dynamic input options and add it into the frame container] hbox = gtk.HBox() colorbox = gtk.EventBox() colorbox.add(hbox) hbox.show() colorbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("GREEN")) frame.add(colorbox) colorbox.show() # [Create button to unscaled the display] self._hbox_UnScaled.show() button3 = gtk.Button("+") # [Make a gdk.color for BLUE] map = button3.get_colormap() color = map.alloc_color("orange") # [copy the current style and replance the background] style = button3.get_style().copy() style.bg[gtk.STATE_NORMAL] = color button3.set_style(style) button3.show() button3.connect("clicked", self.UnScaled) self._hbox_UnScaled.pack_end(button3) # [Create button to scaled the display] self._hbox_Scaled.show() button4 = gtk.Button("-") # [Make a gdk.color for BLUE] map = button4.get_colormap() color = map.alloc_color("Yellow") # [copy the current style and replance the background] style = button4.get_style().copy() style.bg[gtk.STATE_NORMAL] = color button4.set_style(style) button4.show() button4.connect("clicked", self.Scaled) self._hbox_Scaled.pack_end(button4) # [Set the configuration to display the UnScaled button and hide the Scaled button] self._hbox_UnScaled.hide() self._hbox_Scaled.show() # [Create button for Submit display to show the changes in display for the dynamic inputs] button2 = gtk.Button("Submit") # [Make a gdk.color for BLUE] map = button2.get_colormap() color = map.alloc_color("White") # [copy the current style and replance the background] style = button2.get_style().copy() style.bg[gtk.STATE_NORMAL] = color button2.set_style(style) button2.show() button2.connect("clicked", self.SubmitButton) # [Create button for Initial display to back to default display] button5 = gtk.Button("Initial") # [Make a gdk.color for BLUE] map = button5.get_colormap() color = map.alloc_color("RED") # [copy the current style and replance the background] style = button5.get_style().copy() style.bg[gtk.STATE_NORMAL] = color button5.set_style(style) button5.show() button5.connect("clicked", self.InitialButton) # [Getting the dynamic input for topN box] def topN_changed(widget): self._topN = widget.get_text() self._thr = "" return # [Getting the dynamic input for the Threshold box] def threshold_changed(widget): self._thr = widget.get_text() self._topN = "" return # [Set the horizontal Box with the entry textArea to display the TopN option and ask the user for the dynamic input of topN value] hbox_TopN = gtk.HBox() hbox_TopN.show() label = gtk.Label() label.set_markup(" TopN(#): ") label.show() hbox_TopN.pack_start(label,0,0) self._entry_TopN = gtk.Entry() self._entry_TopN.set_text("8") self._entry_TopN.show() self._entry_TopN.set_width_chars(15) self._entry_TopN.connect("changed", topN_changed) hbox_TopN.pack_end(self._entry_TopN) # [Set the horizontal Box with the entry textArea to display the Threshold option and ask the user for the dynamic input of threshold value] hbox_Thr = gtk.HBox() hbox_Thr.show() label = gtk.Label() label.set_markup(" Threshold(%): ") label.show() hbox_Thr.pack_start(label,0,0) self._entry_Thr = gtk.Entry() self._entry_Thr.show() self._entry_Thr.set_width_chars(15) self._entry_Thr.connect("changed", threshold_changed) hbox_Thr.pack_end(self._entry_Thr) # [Set the horizontal Box with the hidden level] hidden0 = gtk.HBox() hidden0.show() label = gtk.Label() label.set_markup(" ") label.show() hidden0.pack_start(label) # [Add the checkbox for flags] self.check_box0 = gtk.CheckButton("mem") if self._exstatus: self.check_box0.set_active(True) else: self.check_box0.set_active(False) self.check_box0.set_sensitive(False) self.check_box0.connect("toggled",self.mem_checkbox, self.check_box0) self.check_box0.show() self.check_box1 = gtk.CheckButton("ins") if wsAnaFlag: if self._exstatus: self.check_box1.set_active(False) else: self.check_box1.set_active(False) self.check_box1.set_sensitive(False) else: if self._exstatus: self.check_box1.set_active(True) else: self.check_box1.set_active(False) self.check_box1.set_sensitive(False) self.check_box1.connect("toggled",self.ins_checkbox, self.check_box1) self.check_box1.show() self.check_box2 = gtk.CheckButton("cycle") self.check_box2.set_active(False) if not(self._exstatus): self.check_box2.set_sensitive(False) self.check_box2.connect("toggled",self.cycle_checkbox, self.check_box2) self.check_box2.show() self.check_box3 = gtk.CheckButton("CPI") self.check_box3.set_active(False) if not(self._exstatus): self.check_box3.set_sensitive(False) self.check_box3.connect("toggled",self.cpi_checkbox, self.check_box3) self.check_box3.show() self.check_box4 = gtk.CheckButton("B/ins") self.check_box4.set_active(False) if not(self._exstatus): self.check_box4.set_sensitive(False) self.check_box4.connect("toggled",self.bpi_checkbox, self.check_box4) self.check_box4.show() self.check_box5 = gtk.CheckButton("B/cycle") self.check_box5.set_active(False) if not(self._exstatus): self.check_box5.set_sensitive(False) self.check_box5.connect("toggled",self.bpc_checkbox, self.check_box5) self.check_box5.show() self.check_box6 = gtk.CheckButton("iBF") self.check_box6.set_active(False) if not(self._exstatus): self.check_box6.set_sensitive(False) self.check_box6.connect("toggled",self.ibf_checkbox, self.check_box6) self.check_box6.show() self.check_box7 = gtk.CheckButton("flop") if wsAnaFlag: if self._exstatus: self.check_box7.set_active(False) else: self.check_box7.set_active(False) self.check_box7.set_sensitive(False) else: if self._exstatus: self.check_box7.set_active(True) else: self.check_box7.set_active(False) self.check_box7.set_sensitive(False) self.check_box7.connect("toggled",self.flop_checkbox, self.check_box7) self.check_box7.show() # [Add the checkbox for memRW flag] self.check_box9 = gtk.CheckButton("R,W [B]") self.check_box9.set_active(False) if not(self._exstatus): self.check_box9.set_sensitive(False) self.check_box9.connect("toggled",self.memRW_checkbox, self.check_box9) self.check_box9.show() # [Add the checkbox for mem dep flag] self.check_box8 = gtk.CheckButton("mem dep") #print "check", self._filename.replace(self._CWD,"") if not(self._exstatus) or (self._filename.replace(self._CWD,"") == "/lcct.dat"): self.check_box8.set_active(False) self.check_box8.set_sensitive(False) else: self.check_box8.set_active(True) self.check_box8.connect("toggled",self.dep_checkbox, self.check_box8) self.check_box8.show() # for workingSetAna self.check_box10 = gtk.CheckButton("wsPage") self.check_box10.set_active(False) if not(self._exstatus) or wsAnaFlag==0: self.check_box10.set_sensitive(False) self.check_box10.connect("toggled",self.wsPage_checkbox, self.check_box10) self.check_box10.show() self.check_box11 = gtk.CheckButton("wsRead") self.check_box11.set_active(False) if not(self._exstatus) or wsAnaFlag==0: #if not(self._exstatus): self.check_box11.set_sensitive(False) self.check_box11.connect("toggled",self.wsRead_checkbox, self.check_box11) self.check_box11.show() self.check_box12 = gtk.CheckButton("wsWrite") self.check_box12.set_active(False) #if not(self._exstatus): if not(self._exstatus) or wsAnaFlag==0: self.check_box12.set_sensitive(False) self.check_box12.connect("toggled",self.wsWrite_checkbox, self.check_box12) self.check_box12.show() # [Set the horizontal Box with the hidden level] hidden1 = gtk.HBox() hidden1.show() label = gtk.Label() label.set_markup(" ") label.show() hidden1.pack_start(label) # [Set the horizontal Box with the hidden level] hidden = gtk.HBox() hidden.show() label = gtk.Label() label.set_markup(" ") label.show() hidden.pack_start(label,0,0) # [Declare the function for combobox to get the changes upon the user selection] def combobox_changed(widget): self._mode = widget.get_text() if self._mode == "Threshold": hbox_Thr.show() hbox_TopN.hide() if self._mode == "TopN": hbox_TopN.show() hbox_Thr.hide() return # [Declare the combo box for user dynamic input] combo = gtk.Combo() combo.set_use_arrows_always(1) combo.entry.set_editable(0) combo.set_popdown_strings(vizPNGLcctm.DisplayModes) combo.entry.connect("changed", combobox_changed) combo.show() # [Set the changed method for combo box and add it to the hbox] combobox_changed(combo.entry) # hbox.pack_start(combo) # [Fill the main hbox container with the individual hbox and end with the Submit button] hbox.pack_start(self.check_box0) hbox.add(self.check_box9) hbox.add(self.check_box1) hbox.add(self.check_box7) hbox.add(self.check_box2) hbox.add(self.check_box3) hbox.add(self.check_box4) hbox.add(self.check_box5) hbox.add(self.check_box6) hbox.add(self.check_box10) hbox.add(self.check_box11) hbox.add(self.check_box12) hbox.add(hidden1) hbox.add(self.check_box8) hbox.add(hidden0) hbox.add(combo) hbox.add(hbox_TopN) hbox.add(hbox_Thr) hbox.add(hidden) hbox.add(self._hbox_UnScaled) hbox.add(self._hbox_Scaled) hbox.add(button2) hbox.pack_end(button5)
def __init__(self): runwindow = gtk.Window(GTK.WINDOW_TOPLEVEL) runwindow.set_wmclass("icewmcontrolpanel", "IceWMControlPanel") self._root = runwindow tips = gtk.Tooltips() self.rcommands = [] self.cmd_file = ".icewmcp_gtkruncmd" self.last_file = "/usr/X11R6/bin/gedit" runwindow.realize() runwindow.set_title(_("Run a program") + "...") runwindow.set_position(GTK.WIN_POS_NONE) runwindow.set_default_size(415, -2) self.runwindow = runwindow vbox1 = gtk.VBox(0, 0) vbox1.set_border_width(5) self.vbox1 = vbox1 vbox1.pack_start(getImage(getBaseDir() + "icewmcp.png", DIALOG_TITLE), 0, 0, 2) hbox1 = gtk.HBox(1, 0) self.hbox1 = hbox1 cmdlab = gtk.Label(_("Command to run") + ":") cmdlab.set_justify(GTK.JUSTIFY_LEFT) cmdlab.set_alignment(0.06, 0.5) self.cmdlab = cmdlab hbox1.pack_start(cmdlab, 1, 1, 0) spacer1 = gtk.Label(" ") self.spacer1 = spacer1 hbox1.pack_start(spacer1, 1, 1, 0) vbox1.pack_start(hbox1, 1, 1, 0) hbox2 = gtk.HBox(0, 0) self.hbox2 = hbox2 runcombo = gtk.Combo() self.runcombo = runcombo runentry = runcombo.entry self.runentry = runentry hbox2.pack_start(runcombo, 1, 1, 9) browsebutt = gtk.Button(" " + _("Browse...") + " ") tips.set_tip(browsebutt, _("Select A Program")) browsebutt.connect("clicked", self.showFileSel) self.browsebutt = browsebutt hbox2.pack_start(browsebutt, 0, 0, 0) vbox1.pack_start(hbox2, 1, 1, 2) hbox3 = gtk.HBox(1, 0) hbox3.set_border_width(4) self.hbox3 = hbox3 runbutt = gtk.Button(_("Run")) tips.set_tip(runbutt, _("Run the selected command")) self.runbutt = runbutt self.runbutt.connect("clicked", self.runCommand) hbox3.pack_start(runbutt, 1, 1, 0) spacer2 = gtk.Label(" ") self.spacer2 = spacer2 hbox3.pack_start(spacer2, 0, 0, 0) cancelbutt = gtk.Button(_("Close")) tips.set_tip(cancelbutt, _("Close and exit")) cancelbutt.connect("clicked", self.quitit) self.cancelbutt = cancelbutt hbox3.pack_start(cancelbutt, 1, 1, 0) vbox1.pack_start(hbox3, 1, 1, 5) runwindow.add(vbox1) runwindow.connect("destroy", self.quitit) self.loadCommands() runwindow.set_data( "ignore_return", 1) # don't close the window on 'Return' key press, just 'Esc' runwindow.connect("key-press-event", keyPressClose) runwindow.show_all()
def __init__(self): self.capturing = False assistant = gtk.Assistant() self.assistant = assistant f = open('/proc/asound/cards', 'r') cards = {} for c in f.read().split('\n'): try: dev = int(c.lstrip().split(' ')[0]) name = c.split(']: ')[1] cards[dev] = name except: pass f.close() output = subprocess.Popen(['xrandr', '-q'], stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0] resolutions = [] for line in output.split('\n'): try: if line.startswith('Screen'): res = line.split(',')[1].strip().split(' ') resolutions += ["%sx%s+0+0" % (res[1], res[3])] elif line.find(' connected ') > 0: resolutions += [line.split(' ')[2]] except: pass assistant.connect("close", self.button_pressed, "Close") assistant.connect("cancel", self.button_pressed, "Cancel") vbox = gtk.VBox() vbox.set_border_width(5) page = assistant.append_page(vbox) assistant.set_page_title(vbox, "Page 1: Intro") assistant.set_page_type(vbox, gtk.ASSISTANT_PAGE_INTRO) label = gtk.Label('Screen recording for Opencast Matterhorn…') label.set_line_wrap(True) vbox.pack_start(label, True, True, 0) assistant.set_page_complete(vbox, True) table = gtk.Table(5, 2) table.set_col_spacings(3) assistant.append_page(table) assistant.set_page_title(table, "Page 2: Select options") assistant.set_page_type(vbox, gtk.ASSISTANT_PAGE_CONTENT) # Device selection label = gtk.Label("Select device for audio input:") self.cardchooser = gtk.combo_box_new_text() for d, n in cards.items(): self.cardchooser.append_text(str(d) + ': ' + n) self.cardchooser.append_text('pulse') self.cardchooser.set_active(0) table.attach(label, 0, 1, 0, 1) table.attach(self.cardchooser, 1, 2, 0, 1) # Rregion label = gtk.Label("Region to capture:") #self.regionentry = gtk.Entry() #self.regionentry.set_text( "1920x1200+0+0" ) self.regionentry = gtk.Combo() self.regionentry.set_popdown_strings(resolutions) table.attach(label, 0, 1, 1, 2) table.attach(self.regionentry, 1, 2, 1, 2) # Output file label = gtk.Label("select output file:") #self.filechooserbutton = gtk.FileChooserButton("Select A File", None) self.filechooserbutton = gtk.Entry() table.attach(label, 0, 1, 2, 3) table.attach(self.filechooserbutton, 1, 2, 2, 3) # Audio codec label = gtk.Label("Select audio codec:") self.acodecchooser = gtk.combo_box_new_text() for codec in ['flac', 'libmp3lame', 'libvorbis', 'vorbis', 'aac']: self.acodecchooser.append_text(codec) self.acodecchooser.set_active(0) table.attach(label, 0, 1, 3, 4) table.attach(self.acodecchooser, 1, 2, 3, 4) # Video codec label = gtk.Label("Select video codec:") self.vcodecchooser = gtk.combo_box_new_text() for codec in [ 'mpeg2video', 'libtheora', 'theora', 'vp8', 'libx264', 'libxvid', 'ljpeg', 'flv' ]: self.vcodecchooser.append_text(codec) self.vcodecchooser.set_active(0) table.attach(label, 0, 1, 4, 5) table.attach(self.vcodecchooser, 1, 2, 4, 5) # page complete assistant.set_page_complete(table, True) vbox = gtk.VBox() vbox.set_border_width(5) assistant.append_page(vbox) assistant.set_page_title(vbox, "Page 3: Start capturing") assistant.set_page_type(vbox, gtk.ASSISTANT_PAGE_PROGRESS) self.capturebutton = gtk.Button('Start capturing…') vbox.pack_start(self.capturebutton, False, False, 0) self.capturebutton.connect('clicked', self.capture) vbox = gtk.VBox() vbox.set_border_width(5) assistant.append_page(vbox) assistant.set_page_title(vbox, "Page 4: The Finale") assistant.set_page_type(vbox, gtk.ASSISTANT_PAGE_SUMMARY) label = gtk.Label("TODO: Upload to Opencast Matterhorn…") label.set_line_wrap(True) vbox.pack_start(label, True, True, 0) assistant.set_page_complete(vbox, True) assistant.show_all()
def __init__(self) : pyspoolwin=gtk.Window(gtk.WINDOW_TOPLEVEL) self._root=pyspoolwin pyspoolwin.realize() pyspoolwin.set_title('PySpool: '+_("Printer Queue")+' version '+PYPRINT_VERSION) pyspoolwin.set_position(gtk.WIN_POS_CENTER) self.pyspoolwin=pyspoolwin mainvbox=gtk.VBox(0,0) self.mainvbox=mainvbox mymenu=gtk.MenuBar() self.mymenu=mymenu ag = gtk.AccelGroup() self.itemf = gtk.ItemFactory(gtk.MenuBar, "<main>", ag) self.itemf.create_items([ # path key callback action# type (_("/ _File"), "<alt>F", None, 0, "<Branch>"), (_("/ _File")+"/_"+FILE_RUN,"<control>R", rundlg,421,""), (_("/ _File")+"/_"+_("Check for newer versions of this program..."), "<control>U", checkSoftUpdate,420,""), (_("/ _File/_Quit"), "<control>Q", self.doQuit, 10, ""), (_("/_Help"), "<alt>H", None, 16, "<LastBranch>"), (_("/_Help/_About")+" PySpool...", "F2", self.doAbout, 17, ""), (_("/_Help")+"/_"+APP_HELP_STR, "F4", displayHelp,5008, ""), (_("/_Help")+"/_"+CONTRIBUTORS+"...", "F3", show_credits,913, ""), (_("/_Help")+"/_"+BUG_REPORT_MENU+"...", "F5", file_bug_report,5008, ""), ]) pyspoolwin.add_accel_group(ag) mymenu = self.itemf.get_widget("<main>") mymenu.show() mainvbox.pack_start(mymenu,0,0,0) hbox1=gtk.HBox(0,12) hbox1.set_border_width(10) pic=loadImage(getPixDir()+"pyprint_printer_big.xpm",pyspoolwin) if pic: hbox1.pack_start(pic,0,0,0) self.hbox1=hbox1 label8=gtk.Label(_('Select Printer:')) self.label8=label8 pyspoolwin.set_size_request(680,-1) hbox1.pack_start(label8,0,0,0) printcombo=gtk.Combo() printcombo.set_size_request(200,-1) self.printcombo=printcombo combo_entry=printcombo.entry combo_entry.set_editable(0) self.combo_entry=combo_entry hbox1.pack_start(printcombo,0,0,0) viewbutt=gtk.Button(_(' View ')) TIPS.set_tip(viewbutt,_(' View ')) viewbutt.connect("clicked",self.changeView) self.viewbutt=viewbutt hbox1.pack_start(viewbutt,0,0,0) mainvbox.pack_start(hbox1,0,0,0) hbox3=gtk.HBox(0,8) hbox3.set_border_width( 4) self.hbox3=hbox3 mytable=gtk.Table(5,2,0) mytable.set_row_spacings(3) mytable.set_col_spacings(7) self.mytable=mytable label15=gtk.Label(_('Description:')) label15.set_alignment(0,0.5) self.label15=label15 mytable.attach(label15,0,1,0,1,(gtk.FILL),(0),0,0) label16=gtk.Label(_('Queue:')) label16.set_alignment( 0,0.5) self.label16=label16 mytable.attach(label16,0,1,1,2,(gtk.FILL),(0),0,0) label17=gtk.Label(_('Server:')) label17.set_alignment(0,0.5) self.label17=label17 mytable.attach(label17,0,1,2,3,(gtk.FILL),(0),0,0) label18=gtk.Label(_('Status:')) label18.set_alignment( 0,0.5) self.label18=label18 mytable.attach(label18,0,1,3,4,(gtk.FILL),(0),0,0) label19=gtk.Label(_('Info:')) label19.set_alignment( 0,0.5) self.label19=label19 mytable.attach(label19,0,1,4,5,(gtk.FILL),(0),0,0) desc_text=gtk.Entry() self.desc_text=desc_text desc_text.set_editable(0) mytable.attach(desc_text,1,2,0,1,(gtk.EXPAND+gtk.FILL),(0),0,0) q_text=gtk.Entry() self.q_text=q_text q_text.set_editable(0) mytable.attach(q_text,1,2,1,2,(gtk.EXPAND+gtk.FILL),(0),0,0) server_text=gtk.Entry() self.server_text=server_text server_text.set_editable(0) mytable.attach(server_text,1,2,2,3,(gtk.EXPAND+gtk.FILL),(0),0,0) status_text=gtk.Entry() self.status_text=status_text status_text.set_editable(0) mytable.attach(status_text,1,2,3,4,(gtk.EXPAND+gtk.FILL),(0),0,0) info_text=gtk.Entry() info_text.set_editable(0) self.info_text=info_text mytable.attach(info_text,1,2,4,5,(gtk.EXPAND+gtk.FILL),(0),0,0) hbox3.pack_start( mytable,1,1,0) vbox3=gtk.VBox(1,7) self.vbox3=vbox3 refreshbutt=getImageButton("pyprint_reload.xpm",_("Refresh Queue Details"),pyspoolwin) TIPS.set_tip(refreshbutt,_("Refresh Queue Details")) refreshbutt.connect("clicked",self.loadDetailsR) self.refreshbutt=refreshbutt vbox3.pack_start( refreshbutt,0,0,0) cancelbutt=getImageButton("pyprint_cancel.xpm",_("Cancel Selected Print Job"),pyspoolwin) TIPS.set_tip(cancelbutt,_("Cancel Selected Print Job")) cancelbutt.connect("clicked",self.cancelJob) self.cancelbutt=cancelbutt vbox3.pack_start( cancelbutt,0,0,0) hbox3.pack_start( vbox3,0,0,0) mainvbox.pack_start(hbox3,0,0,4) scrollwin=gtk.ScrolledWindow() scrollwin.set_border_width(3) scrollwin.set_size_request(-1,170) self.scrollwin=scrollwin myclist=gtk.CList(7) myclist.connect("unselect_row",self.startUpdates) myclist.connect("select_row",self.makeSelection) myclist.column_titles_show() myclist.set_column_width(0,70) myclist.set_column_width(1,53) myclist.set_column_width(2,71) myclist.set_column_width(3,110) myclist.set_column_width(4,117) myclist.set_column_width(5,78) myclist.set_column_width(6,40) self.myclist=myclist label1=gtk.Button(_('State')) self.label1=label1 myclist.set_column_widget(0,label1) label2=gtk.Button(_('Job ID')) self.label2=label2 myclist.set_column_widget(1,label2) label3=gtk.Button(_('Size')) self.label3=label3 myclist.set_column_widget(2,label3) label4=gtk.Button(_('Files')) self.label4=label4 myclist.set_column_widget(3,label4) label5=gtk.Button(_('Owner/ID')) self.label5=label5 myclist.set_column_widget(4,label5) label6=gtk.Button(_('Time')) self.label6=label6 myclist.set_column_widget(5,label6) label7=gtk.Button(_('Class')) self.label7=label7 myclist.set_column_widget(6,label7) scrollwin.add(myclist) mainvbox.pack_start(scrollwin,1,1,0) mystatusbar=gtk.Statusbar() self.mystatusbar=mystatusbar statid=mystatusbar.get_context_id("spooler") self.statid=statid mainvbox.pack_start(mystatusbar,0,0,0) pyspoolwin.add( mainvbox) pyspoolwin.connect("destroy",self.doQuit) global SELECTED_PRINTER SELECTED_PRINTER=None global SELECTING SELECTING=0 global JOB_ID JOB_ID=-1 pyspoolwin.show_all() self.checkPath() # check for needed executables # correct any problems with the printer queue directories launch("checkpc -f > /dev/null") try: self.loadDetails() except: pass gtk.timeout_add(1500,self.autoLoad) # reload the details every 1.5 seconds
def __init__(self): # widgets self._widget = None self._model = None self._status = None self._label = None # other self._NumId = 0 self._NumBbl = 0 self._NumIns = 0 self._SizeCode = 0 self._SizeStub = 0 self._SizeX = 0 self._breakpoints = [] # vbox = gtk.VBox() vbox.show() self._widget = vbox #<<<<<<<<<<<<< ############################################################################ ## title row ############################################################################ hbox = gtk.HBox() hbox.show() vbox.pack_start(hbox,0,0) label = gtk.Label() label.set_markup("<b>ha!</b>") label.show() self._status = label #<<<<<<<<<<<<< hbox.pack_start(label,0,0) def button_reload(widget): self._model.clear() if self._mode == "plain": for (addr,trace) in Trace.CodeCache: if trace._type == "X": continue self.add_trace(trace) elif self._mode == "detailed": for (addr,trace) in Trace.CodeCache: self.add_trace(trace) else: assert(0) self.update_status() return button = gtk.Button("Refresh Display") button.show() hbox.pack_end(button,0,0) button.connect("clicked", button_reload) self._mode = None def combobox_changed(widget): self._mode = widget.get_text() return combo = gtk.Combo() combo.set_use_arrows_always(1) # combo.disable_activate() combo.entry.set_editable(0) combo.set_popdown_strings(CodeCacheWidget.DisplayModes) combo.entry.connect("changed", combobox_changed) combo.show() combobox_changed(combo.entry) hbox.pack_end(combo,0,0,0) ############################################################################ ## table ############################################################################ self._model = apply(gtk.ListStore,[obj for (obj,title) in CodeCacheWidget.TableRows]) if 1: window = self.create_list_widget() vbox.pack_start(window) else: hpane = gtk.HPaned() hpane.show() vbox.pack_start(hpane) window = self.create_list_widget() hpane.add1(window) window = self.create_list_widget() hpane.add2(window) ############################################################################ ## individual trace ############################################################################ frame = gtk.Frame("Individual Trace") # frame.set_shadow_type( gtk.SHADOW_ETCHED_IN) frame.show() vbox.pack_start(frame,0,0) hbox = gtk.HBox() hbox.show() frame.add(hbox) button = gtk.Button(" Flush ") button.show() hbox.pack_end(button,0,0) label = gtk.Label(" id ") label.show() hbox.pack_start(label,0,0) adjustment = gtk.Adjustment(value=0, lower=0, upper=1000000000, step_incr=1, page_incr=100, page_size=100) spinbutton = gtk.SpinButton(adjustment, climb_rate=1.0, digits=0) spinbutton.show() hbox.pack_start(spinbutton,0,0) label = gtk.Label() label.set_markup("") label.show() self._label = label #<<<<<<<<<<<<< hbox.pack_start(label,0,0) def id_change(widget): id = int(widget.get_value()) trace = FindTraceById(id) self._label.set_markup( trace and trace.trace2markup() or "<b>trace not found</b>") return adjustment.connect("value_changed", id_change) adjustment.set_value(0) ############################################################################ ## action ############################################################################ frame = gtk.Frame("Trace Cache") frame.show() vbox.pack_start(frame,0,0) hbox = gtk.HBox() hbox.show() frame.add(hbox) button = gtk.Button(" Flush ") button.show() hbox.pack_end(button,0,0) def button_stats(widget): print self._status.get_text() return button = gtk.Button(" Print Stats ") button.show() hbox.pack_end(button,0,0) button.connect("clicked", button_stats) self._dump_counter = 0 def inc_and_set_count(widget): self._dump_counter += 1 widget.set_label(" Save As: dump.%d.trace " % self._dump_counter) return def button_dump_trace(widget): DumpTraceFile( "dump.%d.trace" % self._dump_counter) inc_and_set_count(widget) return button = gtk.Button("") inc_and_set_count( button ) button.show() hbox.pack_end(button,0,0) button.connect("clicked", button_dump_trace) ############################################################################ ## breakpoints ############################################################################ frame = gtk.Frame("Break Points") frame.show() vbox.pack_start(frame,0,0) hbox = gtk.HBox() hbox.show() frame.add(hbox) self._tracing = 0 def button_resume(widget): if self._tracing: return self._tracing = 1 widget.set_label("Tracing ...") gobject.io_add_watch(self._tf, gobject.IO_IN , TrackFile) return button = gtk.Button("Start Tracing") button.show() hbox.pack_end(button,0,0) button.connect("clicked", button_resume) self._trace_button = button #<<<<<<<<<<<<< button = gtk.CheckButton("Break on Flush") button.show() hbox.pack_end(button,0,0) def breakpoint_changed(widget): self._breakpoints = [string.strip(s) for s in string.split(widget.get_text(),",")] for (index,value) in enumerate(self._breakpoints): try: self._breakpoints[index] = long(value,0) except: pass print "breakpoints: ", self._breakpoints return entry = gtk.Entry() entry.show() # entry.connect("activate", breakpoint_changed) entry.connect("changed", breakpoint_changed) hbox.pack_start(entry) return
def __init__(self) : # You may need to edited TIME_ZONE_INFO_FILE and ZONEINFO_DIR values if # your timezone information is stored someplace other than # /etc/localtime or if your 'zoneinfo' directory cannot be determined # (you will see the error). The value of ZONEINFO_DIR can usually be # determined automatically if TIME_ZONE_INFO_FILE is valid on your # system, exists, and is a SYMLINK. You may also need to edit # TIME_ZONE_DESC_FILE. # This file usually links to a timezone file on /usr/share/zoneinfo/ # path global TIME_ZONE_INFO_FILE TIME_ZONE_INFO_FILE='/etc/localtime' # Leave blank for automatic detection global ZONEINFO_DIR ZONEINFO_DIR='/usr/share/zoneinfo' # This file holds the 'nice' name for the timezone global TIME_ZONE_DESC_FILE TIME_ZONE_DESC_FILE='/etc/timezone' global CLOCK_VERSION CLOCK_VERSION=this_software_version clockwin=gtk.Window(gtk.WINDOW_TOPLEVEL) self._root=clockwin clockwin.realize() clockwin.set_title('PhrozenClock gtk') clockwin.set_position(gtk.WIN_POS_CENTER) self.clockwin=clockwin mynotebook=gtk.Notebook() mynotebook.set_border_width(2) self.mynotebook=mynotebook self.locateZoneinfo() global TZ_DICT self.loadTimeZones() tznames=TZ_DICT.keys() tznames.sort() global HOUR24 HOUR24={"00":"12","01":"1","02":"2","03":"3","04":"4","05":"5","06":"6","07":"7","08":"8","09":"9","10":"10","11":"11","12":"12","13":"1","14":"2","15":"3","16":"4","17":"5","18":"6","19":"7","20":"8","21":"9","22":"10","23":"11","24":"12"} vbox1=gtk.VBox(0,0) self.vbox1=vbox1 hbox2=gtk.HBox(0,0) self.hbox2=hbox2 mycal=gtk.Calendar() mycal.display_options((gtk.CALENDAR_SHOW_HEADING | gtk.CALENDAR_SHOW_DAY_NAMES)) self.mycal=mycal hbox2.pack_start(mycal,0,0,2) mycal.connect("button_press_event",self.stopDayUpdates) vbox2=gtk.VBox(1,0) self.vbox2=vbox2 label3=gtk.Label('timeholder') self.label3=label3 vbox2.pack_start(label3,0,0,3) hbox3=gtk.HBox(0,4) hbox3.set_border_width(6) self.hbox3=hbox3 hourcombo=gtk.Combo() hourcombo.set_popdown_strings(['1','2','3','4','5','6','7','8','9','10','11','12']) hourcombo.set_size_request(58,-1) self.hourcombo=hourcombo combo_entry4=hourcombo.entry combo_entry4.set_editable(0) hourcombo.set_border_width(2) self.combo_entry4=combo_entry4 hbox3.pack_start(hourcombo,0,0,0) label4=gtk.Label(':') self.label4=label4 hbox3.pack_start(label4,0,0,0) minutecombo=gtk.Combo() sixty=['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59'] minutecombo.set_popdown_strings(sixty) minutecombo.set_size_request(58,-1) minutecombo.set_border_width(2) self.minutecombo=minutecombo combo_entry5=minutecombo.entry combo_entry5.set_editable(0) self.combo_entry5=combo_entry5 hbox3.pack_start(minutecombo,0,0,0) label5=gtk.Label(':') self.label5=label5 hbox3.pack_start(label5,0,0,0) secondcombo=gtk.Combo() secondcombo.set_popdown_strings(sixty) secondcombo.set_size_request(58,-1) secondcombo.set_border_width(2) self.secondcombo=secondcombo combo_entry6=secondcombo.entry combo_entry6.set_editable(0) self.combo_entry6=combo_entry6 hbox3.pack_start(secondcombo,0,0,0) apcombo=gtk.Combo() apcombo.set_popdown_strings(['AM','PM']) apcombo.set_border_width(2) apcombo.set_size_request(68,-1) self.apcombo=apcombo combo_entry7=apcombo.entry combo_entry7.set_editable(0) self.combo_entry7=combo_entry7 hbox3.pack_start(apcombo,0,0,0) combo_entry4.connect("grab_focus",self.stopUpdates) combo_entry5.connect("grab_focus",self.stopUpdates) combo_entry6.connect("grab_focus",self.stopUpdates) combo_entry7.connect("grab_focus",self.stopUpdates) vbox2.pack_start(hbox3,0,0,0) hbox2.pack_start(vbox2,1,1,0) vbox1.pack_start(hbox2,1,1,0) hbox1=gtk.HBox(1,4) hbox1.set_border_width(9) self.hbox1=hbox1 aboutbutt=gtk.Button(_('About')) TIPS.set_tip(aboutbutt,_('About')) aboutbutt.connect("clicked",self.doAbout) self.aboutbutt=aboutbutt hbox1.pack_start(aboutbutt,0,1,0) rsetbutt=gtk.Button(_('Reset')) TIPS.set_tip(rsetbutt,_('Reset')) rsetbutt.connect("clicked",self.doReset) self.rsetbutt=rsetbutt hbox1.pack_start(rsetbutt,0,1,0) okbutt=gtk.Button(_('OK')) TIPS.set_tip(okbutt,_('OK')) okbutt.connect("clicked",self.applyQuit) self.okbutt=okbutt hbox1.pack_start(okbutt,0,1,0) applybutt=gtk.Button(_('Apply')) TIPS.set_tip(applybutt,_('Apply')) applybutt.connect("clicked",self.applyDate) self.applybutt=applybutt hbox1.pack_start(applybutt,0,1,0) closebutt=gtk.Button(_('Cancel')) TIPS.set_tip(closebutt,_('Cancel')) self.closebutt=closebutt hbox1.pack_start(closebutt,0,1,0) closebutt.connect("clicked",doQuit) vbox1.pack_start(hbox1,0,0,0) tab1lab=gtk.Label(_('Date & Time')) self.tab1lab=tab1lab mynotebook.append_page(vbox1,tab1lab) vbox3=gtk.VBox(0,0) vbox3.set_border_width(4) self.vbox3=vbox3 hbox4=gtk.HBox(0,10) self.hbox4=hbox4 label6=gtk.Label(_('Current Time Zone:')) label6.set_alignment(0.0,0.5) self.label6=label6 hbox4.pack_start(label6,0,0,1) timezonetext=gtk.Entry() timezonetext.set_editable(0) self.timezonetext=timezonetext hbox4.pack_start(timezonetext,1,1,0) vbox3.pack_start(hbox4,1,1,0) label7=gtk.Label(_('To change the timezone,select your area from the list below:')) label7.set_alignment(0.01,0.5) self.label7=label7 vbox3.pack_start(label7,0,0,0) zonebox=gtk.HBox() zonebox.set_spacing(12) timezonelist=gtk.Combo() self.timezonelist=timezonelist timezoneentry=timezonelist.entry self.timezoneentry=timezoneentry timezoneentry.set_editable(0) timezonelist.set_popdown_strings(tznames) zonebox.pack_start(timezonelist,1,1,0) zonebutton=gtk.Button(_("Set Time Zone")) TIPS.set_tip(zonebutton,_("Set Time Zone")) zonebutton.connect("clicked",self.applyZone) self.zonebutton=zonebutton zonebox.pack_start(zonebutton,0,0,0) vbox3.pack_start(zonebox,0,1,0) tab2lab=gtk.Label(_('Time Zone')) self.tab2lab=tab2lab mynotebook.append_page(vbox3,tab2lab) vbox=gtk.VBox(0,0) vbox.set_spacing(3) menu_items = ( (_('/_File'), None, None, 0, '<Branch>'), (_("/_File")+"/_"+FILE_RUN,'<control>R', rundlg,421,""), (_("/_File")+"/_"+_("Check for newer versions of this program..."), '<control>U', checkSoftUpdate,420,""), (_('/File/sep1'), None, None, 1, '<Separator>'), (_('/File/_Exit'), '<control>Q', doQuit, 0, ''), (_('/_Help'), None, None, 0, '<LastBranch>'), (_('/Help/_About...'), "F2", self.doAbout, 0, ''), (_("/_Help")+"/_"+APP_HELP_STR, "F4", displayHelp,5010, ""), (_("/_Help")+"/_"+CONTRIBUTORS+"...", "F3", show_credits,913, ""), (_("/_Help")+"/_"+BUG_REPORT_MENU+"...", "F5", file_bug_report,5010, ""), ) ag = gtk.AccelGroup() self.itemf = gtk.ItemFactory(gtk.MenuBar, '<main>', ag) clockwin.add_accel_group(ag) self.itemf.create_items(menu_items) self.menubar = self.itemf.get_widget('<main>') vbox.pack_start(self.menubar,0,0,0) vbox.pack_start(mynotebook,1,1,0) clockwin.add(vbox) self.startUpdates() self.startDayUpdates() global LAST_DATE LAST_DATE=(0,0,0) self.showTime() self.loadTime(1,1) clockwin.show_all() clockwin.connect("destroy",doQuit) global TZW if TZW==1: self.showTZWarning() gtk.timeout_add(100,self.showTime)
def __init__(self, cwd, base_dir, monitor, filename, exstatus, exefile=None): # [Define the constructor variables] self._widget = None self._status = None self._image = None self._combo = None self._thr = "" self._view = None self._hbox = None self._topN = "" self._mode = "TopN" self._filename = filename self._mem = "1" self._ins = "1" self._cycle = "0" self._cpi = "0" self._bpi = "0" self._bpc = "0" self._ibf = "0" self._dep = "0" self._flop = "1" self._dependency = "0" self._eqTHR = "0" self._memRW = "0" self._initial = "0" self._base_DIR = base_dir self._CWD = cwd self._SCR = "HTML" self._monitor = monitor self._exefile = exefile self._exstatus = exstatus #'0' for cycleCnt mode & '1' for instCnt mode #print "execfile name",self._exefile #print 'Base directory: ', self._base_DIR #print 'Base directory: ', self._CWD HtmlView(self) ChangePermission(self) # [Define the vertical box for the display window and add the show option for display] vbox = gtk.VBox() vbox.show() # [Add the vbox container in widget] self._widget = vbox # [Define the horizontal box for the display window and add the show option for display] self._hbox = gtk.HBox() self._hbox.show() # [Add the hbox container in the vertical box] vbox.pack_start(self._hbox, 0, 0) # [Define the gtk scrolledwindow method for displaying the scrolled window] self.Scrolled_Window = gtk.ScrolledWindow() self.Scrolled_Window.show() # [Add the image container with the scrolled_window variable to show the image] self.Scrolled_Window.add_with_viewport(self._view) self._view.show() ###self._image.show() # [Vertical box container ends with the scrolled_window variable] vbox.pack_end(self.Scrolled_Window, True, True, 8) # [Create frame for create a separate part for dynamic inputs and add the frame with the vbox] frame = gtk.Frame("Change of Threshold & TopN") frame.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("red")) frame.show() colorbox = gtk.EventBox() colorbox.add(frame) colorbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("GOLD")) colorbox.show() vbox.pack_start(colorbox, 0, 0) # [Create a new horizontal box for dynamic input options and add it into the frame container] hbox = gtk.HBox() colorbox = gtk.EventBox() colorbox.add(hbox) hbox.show() colorbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("GOLD")) frame.add(colorbox) colorbox.show() # [Create button for Submit display to show the changes in display for the dynamic inputs] button2 = gtk.Button("Submit") # [Make a gdk.color for BLUE] map = button2.get_colormap() color = map.alloc_color("WHITE") # [copy the current style and replance the background] style = button2.get_style().copy() style.bg[gtk.STATE_NORMAL] = color button2.set_style(style) button2.show() button2.connect("clicked", self.SubmitButton) # [Create button for Initial display to back to default display] button5 = gtk.Button("Initial") # [Make a gdk.color for BLUE] map = button5.get_colormap() color = map.alloc_color("RED") # [copy the current style and replance the background] style = button5.get_style().copy() style.bg[gtk.STATE_NORMAL] = color button5.set_style(style) button5.show() button5.connect("clicked", self.InitialButton) # [Getting the dynamic input for topN box] def topN_changed(widget): self._topN = widget.get_text() self._thr = "" return # [Getting the dynamic input for the Threshold box] def threshold_changed(widget): self._thr = widget.get_text() self._topN = "" return # [Set the horizontal Box with the entry textArea to display the TopN option and ask the user for the dynamic input of topN value] hbox_TopN = gtk.HBox() hbox_TopN.show() label = gtk.Label() label.set_markup(" TopN(#): ") label.show() hbox_TopN.pack_start(label, 0, 0) self._entry_TopN = gtk.Entry() self._entry_TopN.set_text("8") self._entry_TopN.show() self._entry_TopN.set_width_chars(15) self._entry_TopN.connect("changed", topN_changed) hbox_TopN.pack_end(self._entry_TopN) # [Set the horizontal Box with the entry textArea to display the Threshold option and ask the user for the dynamic input of threshold value] hbox_Thr = gtk.HBox() hbox_Thr.show() label = gtk.Label() label.set_markup(" Threshold(%): ") label.show() hbox_Thr.pack_start(label, 0, 0) self._entry_Thr = gtk.Entry() self._entry_Thr.show() self._entry_Thr.set_width_chars(15) self._entry_Thr.connect("changed", threshold_changed) hbox_Thr.pack_end(self._entry_Thr) # [Set the horizontal Box with the hidden level] hidden0 = gtk.HBox() hidden0.show() label = gtk.Label() label.set_markup(" ") label.show() hidden0.pack_start(label) # [Add the checkbox for flags] self.check_box = gtk.CheckButton("EqTHR") self.check_box.set_active(False) if not (self._exstatus): self.check_box.set_sensitive(False) self.check_box.connect("toggled", self.eqTHR_checkbox, self.check_box) self.check_box.show() self.check_box0 = gtk.CheckButton("mem") if self._exstatus: self.check_box0.set_active(True) else: self.check_box0.set_active(False) self.check_box0.set_sensitive(False) self.check_box0.connect("toggled", self.mem_checkbox, self.check_box0) self.check_box0.show() self.check_box1 = gtk.CheckButton("ins") if self._exstatus: self.check_box1.set_active(True) else: self.check_box1.set_active(False) self.check_box1.set_sensitive(False) self.check_box1.connect("toggled", self.ins_checkbox, self.check_box1) self.check_box1.show() self.check_box2 = gtk.CheckButton("cycle") self.check_box2.set_active(False) if not (self._exstatus): self.check_box2.set_sensitive(False) self.check_box2.connect("toggled", self.cycle_checkbox, self.check_box2) self.check_box2.show() self.check_box3 = gtk.CheckButton("CPI") self.check_box3.set_active(False) if not (self._exstatus): self.check_box3.set_sensitive(False) self.check_box3.connect("toggled", self.cpi_checkbox, self.check_box3) self.check_box3.show() self.check_box4 = gtk.CheckButton("B/ins") self.check_box4.set_active(False) if not (self._exstatus): self.check_box4.set_sensitive(False) self.check_box4.connect("toggled", self.bpi_checkbox, self.check_box4) self.check_box4.show() self.check_box5 = gtk.CheckButton("B/cycle") self.check_box5.set_active(False) if not (self._exstatus): self.check_box5.set_sensitive(False) self.check_box5.connect("toggled", self.bpc_checkbox, self.check_box5) self.check_box5.show() self.check_box6 = gtk.CheckButton("iBF") self.check_box6.set_active(False) if not (self._exstatus): self.check_box6.set_sensitive(False) self.check_box6.connect("toggled", self.ibf_checkbox, self.check_box6) self.check_box6.show() self.check_box7 = gtk.CheckButton("flop") if self._exstatus: self.check_box7.set_active(True) else: self.check_box7.set_active(False) self.check_box7.set_sensitive(False) self.check_box7.connect("toggled", self.flop_checkbox, self.check_box7) self.check_box7.show() # [Set the horizontal Box with the hidden level] hidden1 = gtk.HBox() hidden1.show() label = gtk.Label() label.set_markup(" ") label.show() hidden1.pack_start(label) # [Add the checkbox for mem dep flag] self.check_box8 = gtk.CheckButton("memDep") self.check_box8.set_active(False) if not (self._exstatus) or (self._filename.replace(self._CWD, "") == "/lcct.dat"): self.check_box8.set_sensitive(False) self.check_box8.connect("toggled", self.dep_checkbox, self.check_box8) self.check_box8.show() # [Add the checkbox for memRW flag] self.check_box9 = gtk.CheckButton("R,W [B]") self.check_box9.set_active(False) if not (self._exstatus): self.check_box9.set_sensitive(False) self.check_box9.connect("toggled", self.memRW_checkbox, self.check_box9) self.check_box9.show() # [Set the horizontal Box with the hidden level] hidden = gtk.HBox() hidden.show() label = gtk.Label() label.set_markup(" ") label.show() hidden.pack_start(label, 0, 0) # [Declare the function for combobox to get the changes upon the user selection] def combobox_changed(widget): self._mode = widget.get_text() if self._mode == "Threshold": hbox_Thr.show() hbox_TopN.hide() if self._mode == "TopN": hbox_TopN.show() hbox_Thr.hide() return # [Declare the combo box for user dynamic input] combo = gtk.Combo() combo.set_use_arrows_always(1) combo.entry.set_editable(0) combo.set_popdown_strings(vizHtmlLcctm.DisplayModes) combo.entry.connect("changed", combobox_changed) combo.show() # [Set the changed method for combo box and add it to the hbox] combobox_changed(combo.entry) #hbox.pack_start(combo) # [Fill the main hbox container with the individual hbox and end with the Submit button] hbox.pack_start(self.check_box0) hbox.add(self.check_box9) hbox.add(self.check_box1) hbox.add(self.check_box7) hbox.add(self.check_box2) hbox.add(self.check_box3) hbox.add(self.check_box4) hbox.add(self.check_box5) hbox.add(self.check_box6) hbox.add(hidden1) hbox.add(self.check_box8) hbox.add(hidden) hbox.add(self.check_box) hbox.add(hidden0) hbox.add(combo) hbox.add(hbox_TopN) hbox.add(hbox_Thr) hbox.add(button2) hbox.pack_end(button5)
def __init__(self) : self.version=this_software_version self.x_comments="# Created by IceWM Control Panel - Window Options version "+self.version+"\n# http://icesoundmanager.sourceforge.net\n# This is an example for IceWM's window options file.\n#\n# Place your variants in ${sysconfdir}/X11/icewm or in $HOME/.icewm\n# since modifications to this file will be discarded when you\n# (re)install icewm.\n\n#userpasswd.layer: OnTop \n#kdepasswd.layer: OnTop\n\n#This controls Wharf geometry for 1024x768\n#licq.Wharf.dBorder: 0\n#licq.Wharf.ignoreTaskBar: 1\n#licq.Wharf.ignoreQuickSwitch: 1\n#licq.Wharf.dTitleBar: 0\n#licq.Wharf.layer: AboveDock\n#licq.Wharf.allWorkspaces: 1\n#licq.Wharf.geometry: +870+790\n\n" global WMCLASS WMCLASS="icewmcpwinoptions" global WMNAME WMNAME="IceWMCPWinOptions" wallwin=gtk.Window(gtk.WINDOW_TOPLEVEL) wallwin.set_wmclass(WMCLASS,WMNAME) wallwin.realize() wallwin.set_title("IceWM CP - "+_("Window Options")+" "+self.version) wallwin.set_position(gtk.WIN_POS_CENTER) self.wallwin=wallwin # added 2.18.2003 - more locale support self.LAYER_NORMAL=_("Normal") self.LAYER_ABOVED=_("AboveDock") self.LAYER_DOCK=_("Dock") self.LAYER_BELOW=_("Below") self.LAYER_DESKTOP=_("Desktop") self.LAYER_ONTOP=_("OnTop") self.LAYER_MENU=_("Menu") self.layer_conv={"Normal":self.LAYER_NORMAL , "AboveDock":self.LAYER_ABOVED, "Dock":self.LAYER_DOCK , "Menu":self.LAYER_MENU , "Desktop":self.LAYER_DESKTOP , "OnTop":self.LAYER_ONTOP , "Below":self.LAYER_BELOW} self.rlayer_conv={} for i,v in self.layer_conv.items(): self.rlayer_conv[v]=i self.layers_list=[self.LAYER_NORMAL,self.LAYER_ABOVED,self.LAYER_BELOW,self.LAYER_DESKTOP,self.LAYER_DOCK,self.LAYER_ONTOP,self.LAYER_MENU] menu_items = ( (_('/_File'), None, None, 0, '<Branch>'), (_('/File/_Open...'), '<control>O', self.openKey, 0, ''), (_('/File/_Save'), '<control>S', self.doSave, 0, ''), (_('/File/sep1'), None, None, 1, '<Separator>'), (_('/File/_Apply Changes Now...'), "<control>A", self.restart_ice, 0, ''), (_('/File/sep2'), None, None, 2, '<Separator>'), (_("/_File")+"/_"+FILE_RUN,"<control>R", rundlg,421,""), (_("/_File")+"/_"+_("Check for newer versions of this program..."), "<control>U", checkSoftUpdate,420,""), (_('/File/sep2'), None, None, 2, '<Separator>'), (_('/File/_Exit'), '<control>Q', self.doQuit, 0, ''), (_('/_Help'), None, None, 0, '<LastBranch>'), (_('/Help/_About...'), "F2", self.do_about, 0, ''), (_("/_Help")+"/_"+APP_HELP_STR, "F4", displayHelp,5004, ""), (_("/_Help")+"/_"+CONTRIBUTORS+"...", "F3", show_credits,913, ""), (_("/_Help")+"/_"+BUG_REPORT_MENU+"...", "F5", file_bug_report,5004, ""), ) ag = gtk.AccelGroup() self.itemf = gtk.ItemFactory(gtk.MenuBar, '<main>', ag) wallwin.add_accel_group(ag) self.itemf.create_items(menu_items) self.menubar = self.itemf.get_widget('<main>') self.preffile="" try: self.preffile=getIceWMPrivConfigPath()+"winoptions" except: pass mainvbox1=gtk.VBox(0,1) mainvbox=gtk.VBox(0,1) mainvbox1.pack_start(self.menubar,0,0,0) mainvbox1.pack_start(mainvbox,1,1,0) mainvbox.set_border_width(4) mainvbox.set_spacing(4) mainvbox.pack_start(getImage(getBaseDir()+"icewmcp.png",DIALOG_TITLE),0,0,2) mainvbox.pack_start(gtk.Label(_("Window Options")),0,0,2) hbox1=gtk.HBox(0,0) hbox1.set_spacing(5) sc=gtk.ScrolledWindow() self.winlist=gtk.CList(2,[' '+'wm_class',' '+'wm_name']) self.sc=sc sc.add(self.winlist) sc.set_size_request(300,-1) self.winlist.set_column_width(0,120) vb=gtk.VBox(0,0) edbox=gtk.HBox(1,0) edbox.set_spacing(4) vb.pack_start(sc,1,1,0) TIPS.set_tip(self.winlist,"Program windows") addbutt=gtk.Button(_("Add...")) TIPS.set_tip(addbutt,_("Add...").replace(".","")) addbutt.connect("clicked",self.show_addkey) delbutt=gtk.Button(_("Delete")) TIPS.set_tip(delbutt,_("Delete")) delbutt.connect("clicked",self.del_key) edbox.pack_start(addbutt,1,1,1) edbox.pack_start(delbutt,1,1,1) vb.pack_start(edbox,0,0,2) vb.pack_start(gtk.HSeparator(),0,0,1) anstr=_('/File/_Apply Changes Now...')[_('/File/_Apply Changes Now...').rfind("/")+1:len(_('/File/_Apply Changes Now...'))].replace(".","").replace("_","") anbutt=gtk.Button(anstr) TIPS.set_tip(anbutt,anstr) anbutt.connect("clicked", self.restart_ice) svnbutt=gtk.Button(_("Save")) TIPS.set_tip(svnbutt,_("Save")) svnbutt.connect("clicked",self.doSave ) vb.pack_start(svnbutt,0,0,1) vb.pack_start(anbutt,0,0,3) hbox1.pack_start(vb,1,1,1) vb2=gtk.VBox(0,0) vb2.set_spacing(2) h1=gtk.HBox(0,0) h1.set_spacing(3) h1.pack_start(gtk.Label(_("Icon: ")),0,0,0) self.iconentry=gtk.Entry() h1.pack_start(self.iconentry,1,1,0) browsebutt=gtk.Button() try: browsebutt.add( loadScaledImage(getPixDir()+"ism_load.png",24,24) ) except: browsebutt.add(gtk.Label(_(" Browse... "))) TIPS.set_tip(browsebutt,_(" Browse... ")) browsebutt.connect("clicked",self.openIcon) h1.pack_start(browsebutt,0,0,0) addDragSupport(self.iconentry,self.setDrag) addDragSupport(browsebutt,self.setDrag) prevframe=gtk.Frame() self.prevlay=gtk.Layout() self.prevlay.set_size(30,30) prevframe.set_size_request(33,33) self.prevlay.show() prevframe.add(self.prevlay) h1.pack_start(gtk.Label(" "),0,0,0) h1.pack_start(prevframe,0,0,0) addDragSupport(prevframe,self.setDrag) h2=gtk.HBox(0,0) h2.set_spacing(3) h2.pack_start(gtk.Label(_("WorkSpace: ")),0,0,0) workentry=gtk.Entry() self.workentry=workentry h2.pack_start(workentry,1,1,0) h3=gtk.HBox(0,0) h3.set_spacing(3) h3.pack_start(gtk.Label(_("Layer: ")),0,0,0) laycom=gtk.Combo() self.layentry=laycom.entry self.layentry.set_editable(0) laycom.set_popdown_strings(self.layers_list) h3.pack_start(laycom,1,1,0) h4=gtk.HBox(0,0) h4.set_spacing(3) h4.pack_start(gtk.Label(_("Geometry: ")),0,0,0) geoentry=gtk.Entry() self.geoentry=geoentry h4.pack_start(geoentry,1,1,0) h5=gtk.HBox(0,0) h5.set_spacing(3) h5.pack_start(gtk.Label(_("Tray Icon: ")),0,0,0) traycom=gtk.Combo() self.trayentry=traycom.entry self.trayentry.set_editable(0) traycom.set_popdown_strings(['No tray icon','When minimized','Tray icon only']) h5.pack_start(traycom,1,1,0) vb2.pack_start(h1,0,0,3) vb2.pack_start(h2,0,0,1) vb2.pack_start(h3,0,0,1) vb2.pack_start(h4,0,0,1) vb2.pack_start(h5,0,0,1) scwin=gtk.ScrolledWindow() winoptlay=gtk.Layout() self.winoptlay=winoptlay winoptlay.set_size(330,500) scwin.add(winoptlay) self.warn_ok=0 worder=['allWorkspaces','startFullscreen','startMaximized','startMaximizedVert','startMaximizedHorz','startMinimized','ignoreWinList','ignoreTaskBar','ignoreQuickSwitch','fullKeys','fMove','fResize','fClose','fMinimize', 'fMaximize','fHide','fRollup','dTitleBar','dSysMenu','dBorder','dResize','dClose','dMinimize','dMaximize','dHide','dRollup','dDepth','ignorePositionHint','doNotFocus','noFocusOnAppRaise','ignoreNoFocusHint','doNotCover','nonICCCMconfigureRequest'] self.winwidgets={} self.windefaults={'allWorkspaces':0,'startFullscreen':0,'startMaximized':0,'startMaximizedVert':0,'startMaximizedHorz':0,'startMinimized':0,'ignoreWinList':0,'ignoreTaskBar':0,'ignoreQuickSwitch':0,'fullKeys':0,'fMove':1,'fResize':1,'fClose':1,'fMinimize':1, 'fMaximize':1,'fHide':1,'fRollup':1,'dTitleBar':1,'dSysMenu':1,'dBorder':1,'dResize':1,'dClose':1,'dMinimize':1,'dMaximize':1,'dHide':1,'dRollup':1,'dDepth':1,'ignorePositionHint':0,'doNotFocus':0, 'noFocusOnAppRaise':0,'ignoreNoFocusHint':0,'doNotCover':0,'nonICCCMconfigureRequest':0,"tray":"Ignore","geometry":"","layer":self.LAYER_NORMAL,"icon":"","workspace":"[DEFAULT]"} self.winhints={'allWorkspaces':"Visible on all workspaces",'startFullscreen':"Start full-screen",'startMaximized':"Start maximized",'startMaximizedVert':"Start vertically maximized",'startMaximizedHorz':"Start horizontally maximized",'startMinimized':"Start minimized",'ignoreWinList':"Do not show in Window List" ,'ignoreTaskBar':"Do not show on taskbar",'ignoreQuickSwitch':"Do not show in Quick-switch window",'fullKeys':"Reserve extra 'F[num]' keys",'fMove':"Moveable",'fResize':"Resizeable",'fClose':"Closeable",'fMinimize':"Minimizeable",'fMaximize':"Maximizeable",'fHide':"Hideable",'fRollup':"Can be rolled up",'dTitleBar':"Has title bar",'dSysMenu':"Has system menu",'dBorder':"Has border",'dResize':"Has resize border",'dClose':"Has CLOSE button",'dMinimize':"Has MINIMIZE button",'dMaximize':"Has MAXIMIZE button",'dHide':"Has HIDE button (if applicable)",'dRollup':"Has ROLLUP button (if applicable)",'dDepth':"Has LAYER button (if applicable)",'ignorePositionHint':"Ignore pre-set window positions",'doNotFocus':"Do not focus",'noFocusOnAppRaise':"Do not focus when app is raised",'ignoreNoFocusHint':"Force focusing",'doNotCover':"Do not cover",'nonICCCMconfigureRequest':"App is non-ICCCM compliant"} self.window_options={} layx=3 layy=2 maxx=layx for ii in worder: ck=gtk.CheckButton(_(self.winhints[ii])) TIPS.set_tip(ck,_(self.winhints[ii])) ck.set_active(self.windefaults[ii]) ck.show() self.winwidgets[ii]=ck self.winoptlay.put(ck,layx,layy) layy=layy+ck.size_request()[1]+3 if ck.size_request()[0]>maxx: maxx=ck.size_request()[0] self.winoptlay.set_size(maxx+20,layy+20) vb2.pack_start(scwin,1,1,0) setbutt=gtk.Button(_("Set")) TIPS.set_tip(setbutt,_("Set")) setbutt.connect("clicked",self.set_key) vb2.pack_start(setbutt,0,0,3) hbox1.pack_start(vb2,1,1,1) mainvbox.pack_start(hbox1,1,1,1) self.status=gtk.Label(_("Ready.")) mainvbox.pack_start(self.status,0,0,0) wallwin.add(mainvbox1) wallwin.connect("destroy",self.doQuit) wallwin.set_default_size(565,600) self.last_icon=None self.loadUp() self.winlist.connect("select_row",self.clist_cb) self.winlist.connect("unselect_row",self.clist_unselect) wallwin.show_all()
def build(self): self.local_rb = gtk.RadioButton(None, _("Connect to this system")) self.vbox.pack_start(self.local_rb) self.remote_rb = gtk.RadioButton(self.local_rb, _("Connect to a remote system")) self.vbox.pack_start(self.remote_rb) table = gtk.Table(3, 2) table.set_border_width(5) table.set_col_spacings(5) table.set_row_spacings(5) l = gtk.Label(_("Server:")) l.set_alignment(0, 0.5) table.attach(l, 0, 1, 0, 1) l = gtk.Label(_("User name:")) l.set_alignment(0, 0.5) table.attach(l, 0, 1, 1, 2) l = gtk.Label(_("Password:"******"toggled", toggled_cb, self) self.remote_rb.connect("toggled", lambda x,y:y.set_sensitive(x.get_active()), table) self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) b = self.add_button(_("Connect"), gtk.RESPONSE_ACCEPT) b.grab_default() def response_cb(dialog, id, this): if id == gtk.RESPONSE_ACCEPT: this.save() self.connect("response", response_cb, self)
def __init__(self): #Leemos las estadísticas y analizamos el nivel máximo jugable, y lo imprimimos por pantalla LeerEstadisticas(self.FEstasts) nivelesPosibles = NivelesPermitidos2(20) #Creación de la ventana con el título self.ventana = gtk.Window() self.ventana.set_icon_from_file('data/UnblockMe.png') self.ventana.size_request() self.ventana.set_resizable(False) self.ventana.set_title('Desbloquea') self.ventana.connect("destroy", gtk.main_quit) #Crear caja vertical cajaV = gtk.VBox() #Crear label (titulo de bienvenida más el nivel máximo jugable) titulo = gtk.Label('\n\nSeleccione un nivel. Niveles disponibles: ' + str(nivelesPosibles) + '\n\n') cajaV.add(titulo) #Crear caja horizontal cajaH = gtk.HBox() #Crear imagen inicial imagenCoche = gtk.Image() imagenCoche.set_from_file("data/inicio.png") cajaV.add(imagenCoche) #Menu_Desplegable (todos los niveles presentes) self.combo = gtk.Combo() slist = [ "01", "02", "03", "04", '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20' ] self.combo.set_popdown_strings(slist) self.combo.set_use_arrows(False) cajaV.add(self.combo) #Boton aceptar (ejecuta la ventana de juego, con el nivel previamente seleccionado en la lista desplegable) boton2 = gtk.Button('Aceptar') boton2.set_size_request(100, 30) boton2.connect('clicked', self.Adelante) cajaH.add(boton2) #Boton salir (ejecuta el cierre completo del programa) botonE = gtk.Button('Salir') botonE.set_size_request(100, 30) botonE.connect('clicked', self.CerrarTodo) cajaH.add(botonE) cajaV.add(cajaH) #Boton para borrar estadísticas (ejecuta la creación de un nuevo archivo de estadisticas, con todo a cero) botonEstadisticas = gtk.Button('Borrar estadísticas') botonEstadisticas.set_size_request(100, 30) botonEstadisticas.connect('clicked', self.BorrarEst) cajaV.add(botonEstadisticas) self.ventana.add(cajaV) self.ventana.show_all()