def __init__(self): self.scriptPath = os.path.dirname(__file__) self.cameraImagePixBuf = None self.lastImage = None self.markerBuffer = None self.filename = None # Connect to the robot via ROS rospy.init_node('GripperMarker', anonymous=True) self.cameraImageTopic = rospy.Subscriber("/camera/image", sensor_msgs.msg.Image, self.cameraImageCallback) self.opticalFlowBlockWidth = self.DEFAULT_OPTICAL_FLOW_BLOCK_WIDTH self.opticalFlowBlockHeight = self.DEFAULT_OPTICAL_FLOW_BLOCK_HEIGHT # Setup the GUI builder = gtk.Builder() builder.add_from_file(self.scriptPath + "/GUI/GripperMarker.glade") self.window = builder.get_object("winMain") self.dwgCameraImage = builder.get_object("dwgCameraImage") self.adjBlockWidth = builder.get_object("adjBlockWidth") self.adjBlockHeight = builder.get_object("adjBlockHeight") self.adjBlockWidth.set_value(self.opticalFlowBlockWidth) self.adjBlockHeight.set_value(self.opticalFlowBlockHeight) builder.connect_signals(self) updateLoop = self.update() gobject.idle_add(updateLoop.next) self.window.show()
def __init__(self): builder = gtk.Builder() builder.add_from_file("logreader.glade") self.window = builder.get_object("log_reader_window") self.exceptions_store = gtk.TreeStore(gobject.TYPE_STRING) self.exceptions_list = builder.get_object("exceptions_list") self.exceptions_list.set_model(self.exceptions_store) builder.connect_signals(self) self.window.connect("destroy", lambda w: gtk.main_quit()) renderer = gtk.CellRendererText() column = gtk.TreeViewColumn("Exception", renderer, text=0) self.exceptions_list.append_column(column) self.datelinks = [] self.exceptions = None self.exception_message_view = builder.get_object( "exception_message_view") self.user_details_view = builder.get_object("user_details_view") self.traceback_detail_view = builder.get_object( "traceback_detail_view") self.frame_details_view = builder.get_object("frame_details_view")
def __init__(self, padre = None): builder = gtk.Builder() builder.add_from_file('wDepositos.glade') builder.connect_signals(self) self.ventana = builder.get_object('ventana') self.buscar = builder.get_object('lblBuscar') self.criterio = builder.get_object('criterio') self.filtro = builder.get_object("filtro") self.tree = builder.get_object('tree') self.lista = builder.get_object('lista') self.statusbar = builder.get_object('statusbar') self.col_data = '' self.resultado = '' self.padre = padre if padre is None: self.frm_padre = self.ventana else: self.frm_padre = self.padre.frm_padre self.crear_columnas() self.on_refrescar_clicked() self.ventana.show()
def __init__(self): # Set environment path import os path="/opt/py_finder/" os.chdir(path) #Set glade file self.gladefile = "./UI_GTK.glade" self.glade = gtk.Builder() self.glade.add_from_file(self.gladefile) self.window=self.glade.get_object("window1") self.window.show_all() self.window.connect("destroy",self.main_quit) self.open_kybd() # Grab Notebook object self.notebook = self.glade.get_object("notebook") # I found this useless and repeated code, do you require this pps ? please delete and commit later if no #self.dic = {"on_apps_searchbox_activate" : self.on_apps_searchbox_activate, "gtk_main_quit" : gtk.main_quit } ## dic start self.dic = { "on_apps_searchbox_activate" : self.on_apps_searchbox_activate, "gtk_main_quit" : self.main_quit, "on_apps_search_button_clicked" : self.on_apps_searchbox_activate, "on_file_searchbox_activate" : self.on_file_searchbox_activate, "on_file_search_button_clicked" : self.on_file_searchbox_activate, "on_notebook_switch_page" : self.on_notebook_focus_tab, "on_quit_button_clicked" : self.on_quit_button_clicked, "on_quit_wo_onboard_clicked" : self.on_quit_wo_onboard_clicked } ## End of dic self.glade.connect_signals(self.dic)
def on_customize_search_shortcuts(smart_bookmarks, shortcuts_to_smart_bookmarks_map): list_store = gtk.ListStore(str, gobject.TYPE_PYOBJECT) _sync_list_store_from_shortcuts_map(list_store, smart_bookmarks, shortcuts_to_smart_bookmarks_map) builder = gtk.Builder() builder.add_from_file( os.path.join(deskbar.SHARED_DATA_DIR, "smart-bookmarks.ui")) view = builder.get_object("bookmarks-view") view.set_model(list_store) crt_shortcut = gtk.CellRendererText() crt_shortcut.set_property("editable", True) crt_shortcut.connect( "edited", _on_shortcut_edited, (list_store, smart_bookmarks, shortcuts_to_smart_bookmarks_map)) tvc_shortcut = gtk.TreeViewColumn(_("Shortcut"), crt_shortcut, text=0) view.append_column(tvc_shortcut) def bookmark_to_bookmark_name(tree_view_column, cell_renderer, model, iter): bookmark = model.get_value(iter, 1) cell_renderer.set_property("text", bookmark.get_name()) crt_name = gtk.CellRendererText() tvc_name = gtk.TreeViewColumn(_("Bookmark Name"), crt_name) tvc_name.set_cell_data_func(crt_name, bookmark_to_bookmark_name) view.append_column(tvc_name) dialog = builder.get_object("smart-bookmarks") dialog.set_icon_name("deskbar-applet") dialog.show_all() dialog.run() dialog.destroy()
def __init__(self): self.glade = "gtkbuilder.glade" self.builder = gtk.Builder() self.builder.add_from_file(self.glade) self.window = self.builder.get_object("window1") dic = { "on_button1_clicked": self.displaymsg, "on_treeview_row_activated": self.displaytree } #adding values to combo box cbox = self.builder.get_object("combobox1") store = gtk.ListStore(gobject.TYPE_STRING) store.append(["vishal"]) store.append(["arun"]) store.append(["sabin"]) cbox.set_model(store) cbox.append_text("hai") cell = gtk.CellRendererText() cbox.pack_start(cell, True) cbox.add_attribute(cell, 'text', 0) cbox.set_active(0) #adding more values to tree view st = self.builder.get_object("datastore") st.append([act[0], act[1]]) #self.builder.get_object("treeview") store = gtk.ListStore(str, str) store.append([act[0], act[1]]) treeview = gtk.TreeView(store) #self.create_columns(treeview) self.builder.connect_signals(dic)
def __init__(self, specto, error_message): self.specto = specto uifile = os.path.join(self.specto.PATH, "uis/notifier.ui") windowname = "error_dialog" self.builder = gtk.Builder() self.builder.set_translation_domain("specto") self.builder.add_from_file(uifile) self.builder.get_object("ok").connect("clicked", self.delete_event) self.builder.get_object("send").connect("clicked", self.send) self.error_dialog = self.builder.get_object("error_dialog") self.error_dialog.show() self.error_dialog.set_icon_from_file(self.specto.LOGO_PATH) self.errorwindow = gtk.TextBuffer(None) self.builder.get_object("error_message").set_buffer(self.errorwindow) self.errorwindow.set_text(error_message) self.builder.get_object("image").set_from_stock(gtk.STOCK_DIALOG_ERROR, \ gtk.ICON_SIZE_DIALOG) self.builder.get_object("label4").set_use_markup(True) self.builder.get_object("label4").set_label(_("<b>Specto encountered an error</b>\nPlease verify if this bug has been entered in our issue tracker, and if not, file a bug report so we can fix it."))
def show_preferences(parent, driver, gconf_client, gconf_key): widget_tree = gtk.Builder() widget_tree.add_from_file( os.path.join(os.path.dirname(__file__), "panel.ui")) dialog = widget_tree.get_object("PanelDialog") dialog.set_transient_for(parent) g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/size", "SizeAdjustment", 24, widget_tree) g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/position", "PositionCombo", "bottom", widget_tree) g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/stretch", "Stretch", False, widget_tree) g15uigconf.configure_colorchooser_from_gconf(gconf_client, gconf_key + "/color", "Color", (128, 128, 128), widget_tree, default_alpha=128) dialog.run() dialog.hide()
def __init__ (self, unitModel=None): debug("Opening PriceSetter screen",2) self.ui = gtk.Builder() self.ui.add_from_file(os.path.join(current_path,'priceSetter.ui')) signals = {"on_add_clicked": self.add_ingredient, "on_remove_clicked": self.remove_ingredient} self.ui.connect_signals(signals) self.iter = {} self.model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_OBJECT, gobject.TYPE_STRING, gobject.TYPE_FLOAT) self.listview = self.ui.get_object("ingTree") self.listview.set_model(self.model) self.listview.set_flags(gtk.TREE_MODEL_ITERS_PERSIST) if unitModel: self.unitModel = unitModel else: self.unitModel = gourmet.GourmetRecipeManager.UnitModel(self.conv) columns = [_("Amt"), _("Unit"), _("Ingredient"), _("Price")] for column_ in columns: if column_ == _("Unit"): column_renderer = gtk.CellRendererCombo() column_renderer.set_property('model',self.unitModel) column_renderer.set_property('text-column',0) else: column_renderer = gtk.CellRendererText() column_renderer.set_property("editable", True) column = gtk.TreeViewColumn(column_, column_renderer, text=2, weight=5) column.set_expand(True) column.set_resizable(True) self.listview.append_column(column)
def __init__(self): self.log = logging.getLogger('scbdo') self.log.setLevel(logging.DEBUG) self.isconn = False b = gtk.Builder() b.add_from_file(os.path.join(scbdo.UI_PATH, 'wheeltime_test.ui')) self.status = b.get_object('status') self.log_buffer = b.get_object('log_buffer') self.log_view = b.get_object('log_view') self.log_view.modify_font(pango.FontDescription("monospace 9")) self.log_scroll = b.get_object('scrollbox').get_vadjustment() self.context = self.status.get_context_id('WheelTest') self.window = b.get_object('window') self.port_ent = b.get_object('port_ent') self.event_id = b.get_object('event_id') self.event_tod = b.get_object('event_tod') self.connect_but_img = b.get_object('connect_but_img') b.connect_signals(self) f = logging.Formatter('%(levelname)s:%(name)s: %(message)s') self.sh = loghandler.statusHandler(self.status, self.context) self.sh.setLevel(logging.INFO) # show info upon status bar self.sh.setFormatter(f) self.log.addHandler(self.sh) self.lh = loghandler.textViewHandler(self.log_buffer, self.log_view, self.log_scroll) self.lh.setLevel(logging.DEBUG) self.lh.setFormatter(f) self.log.addHandler(self.lh) self.wt = wheeltime.wheeltime(addr='localhost') self.port_ent.set_text('localhost') self.running = True glib.timeout_add(100, self.timeout)
def __init__(self, parent=None, filename="demos/demo.ui"): gtk.Window.__init__(self) try: self.set_screen(parent.get_screen()) except AttributeError: self.connect('destroy', lambda *w: gtk.main_quit()) self.set_title(self.__class__.__name__) self.set_default_size(440, 250) # create a new empty Builer object builder = gtk.Builder() # load an XML definition builder.add_from_file(filename) # We must get the vbox and reparent it to self # since we don't use the main window defined in the ui file vbox = builder.get_object("vbox1") vbox.reparent(self) # autoconnect the signals from the instance self builder.connect_signals(self) self.show_all()
def __init__(self): self.timer = timer() self.builder = gtk.Builder() self.homeDir = os.environ['HOME'] try: self.builder.add_from_file(self.homeDir + "/.hgg/start.ui") except: self.builder.add_from_file("start.ui") self.logger = self.builder.get_object("Logger") self.cal = self.builder.get_object("Cal") dic = { "on_Logger_destroy": self.Quit, "on_StartButton_clicked": self.StartLogging, "on_Cal_day_selected": self.CalDayClick, } self.builder.connect_signals(dic) self.logger.show_all() self.conf_file = config_file self.stpTime = [] self.timer.calcStpTime(self.stpTime) self.cal.clear_marks() self.cal.select_month(self.stpTime[1] - 1, self.stpTime[0]) self.cal.select_day(self.stpTime[2]) self.cal.mark_day(self.stpTime[2])
def builder_get_objects_from_file(fname, attrs, autoconnect_to=None): """ Open @fname with gtk.Builder and yield objects named @attrs @fname is sought in the data directories. If @autoconnect_to is not None, signals are autoconnected to this object, and a user_data object is passed as a namespace containing all @attrs """ builder = gtk.Builder() builder.set_translation_domain(version.PACKAGE_NAME) ui_file = config.get_data_file(fname) builder.add_from_file(ui_file) class Namespace(object): pass names = Namespace() for attr in attrs: obj = builder.get_object(attr) setattr(names, attr, obj) yield obj if autoconnect_to: builder.connect_signals(autoconnect_to, user_data=names)
def __init__(self, audio): self.audio = audio self.settings = self._init_settings() gladefile = os.path.join(get_ui_dir(), "main.glade") root = gtk.Builder() root.add_from_file(gladefile) self.store = self._init_participants_tree(root) self.buttons = { 'connection': root.get_object('connetcion_btn'), 'cipher': root.get_object('cipher_btn'), 'recording': root.get_object('recording_btn'), } value = self.settings.setdefault('record_input', True) self.buttons['recording'].set_active(value) self.update_recording_btn(value) value = self.settings.setdefault('do_cipher', True) self.buttons['cipher'].set_active(value) self.update_cipher_btn(value) signals = { 'on_keys_bnt_clicked': self.on_keys_bnt_clicked, 'on_conferences_btn_clicked': self.on_conferences_btn_clicked, 'on_recording_btn_toggled': self.on_recording_btn_toggled, 'on_cipher_btn_toggled': self.on_cipher_btn_toggled, 'on_connetcion_btn_toggled': self.on_connetcion_btn_toggled, 'on_main_wnd_delete_event': self.delete_event, } root.connect_signals(signals) self.wnd = root.get_object('main_wnd') self.wnd.show()
def __init__(self, proyID): # Se carga el archivo glade con la ventana principal objsW = gtk.Builder() objsW.add_from_file('vistas/proy_usr.glade') # Se recuperan los widget a usar (no son necesarios todos) self.winMain = objsW.get_object('winMain') self.textoTitulo = objsW.get_object('textoTitulo') self.vistaIzq = objsW.get_object('vistaIzq') self.vistaDer = objsW.get_object('vistaDer') self.proyID = proyID # Recupera el proyecto para mostrar el nombre proyecto = projects.buscar(proyID) self.textoTitulo.set_text('Proyecto: ' + proyecto.getName()) # Se asocian las senales del archivo glade a metodos de la clase objsW.connect_signals(self) self.winMain.show() self.cargarVistas( True ) # Se llena la vista con los registros (True indica que es la carga inicial)
def __init__(self, mode, ip, port): self.mode = mode self.pipeline = FsUIPipeline() self.pipeline.codecs_changed_audio = self.reset_audio_codecs self.pipeline.codecs_changed_video = self.reset_video_codecs self.builder = gtk.Builder() self.builder.add_from_file(builderprefix + "main-window.ui") self.builder.connect_signals(self) self.mainwindow = self.builder.get_object("main_window") self.audio_combobox = self.builder.get_object("audio_combobox") self.video_combobox = self.builder.get_object("video_combobox") liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) self.audio_combobox.set_model(liststore) cell = gtk.CellRendererText() self.audio_combobox.pack_start(cell, True) self.audio_combobox.add_attribute(cell, 'text', 0) self.reset_audio_codecs() liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) self.video_combobox.set_model(liststore) cell = gtk.CellRendererText() self.video_combobox.pack_start(cell, True) self.video_combobox.add_attribute(cell, 'text', 0) self.reset_video_codecs() if mode == CLIENT: self.client = FsUIClient(ip, port, FsUIParticipant, self.pipeline, self) self.builder.get_object("info_label").set_markup( "Connected to %s:%s" % (ip, port)) elif mode == SERVER: self.server = FsUIListener(port, FsUIServer, FsUIParticipant, self.pipeline, self) self.builder.get_object("info_label").set_markup( "Expecting connections on port %s" % (self.server.port)) self.mainwindow.show()
def createWidgets(self): #Set the Glade file filename = "./gui/gui.glade" builder = gtk.Builder() builder.add_from_file(filename) self.statusbar = builder.get_object("statusbar") window = builder.get_object("mainWindow") builder.connect_signals(self) box = builder.get_object("topologyBox") self.browser = webkit.WebView() canvas = gtk.ScrolledWindow() canvas.add(self.browser) # Pack topology into the box box.pack_start(canvas, True, True, 0) box = builder.get_object("topologyBoxDiscovered") builder.connect_signals(self) self.browserDiscovered = webkit.WebView() canvas = gtk.ScrolledWindow() canvas.add(self.browserDiscovered) # Pack topology into the box box.pack_start(canvas, True, True, 0) self.draw_callback(None) button = builder.get_object("submit") button.connect("clicked", self.submit_callback, builder.get_object("entry_input")) button = builder.get_object("refresh") button.connect("clicked", self.draw_callback) button = builder.get_object("inject") button.connect("clicked", self.inject_callback) window.show_all()
def __init__(self): self.gladefile = "/home/mod/GUI/GUI_STEP-NC_Viewer.ui" self.builder = gtk.Builder() self.builder.add_from_file(self.gladefile) self.window1 = self.builder.get_object("window1") self.window2 = self.builder.get_object("window2") self.textview1 = self.builder.get_object("textview1") self.button1 = self.builder.get_object("button1") self.button2 = self.builder.get_object("button2") self.button3 = self.builder.get_object("button3") self.builder.connect_signals(self) self.buffertexto = gtk.TextBuffer() self.lista = [] self.archivo_name = "/home/testefinal/Temp/Code_original.txt" self.lista = open(self.archivo_name, "r").readlines() for i in range(len(self.lista)): self.buffertexto.insert_at_cursor(self.lista[i]) self.textview1.set_buffer(self.buffertexto) self.x = 715 self.y = 0 self.window1.move(self.x, self.y) self.window1.show() self.window2.hide() self.button1.hide()
def __init__(self): #CREADOR DEL JUEGO self.glade=gtk.Builder() self.glade.add_from_file('menu.glade') self.menu()#Abre el menu self.iconos = [] self.juegoacabado=False self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_cerrada.png")) # Cerrada 0 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_marcada.png")) # Marcada bien 1 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_marcada_error.png")) # Marcada mal 2 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_0.png")) # 0 minas 3 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_1.png")) # 1 mina 4 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_2.png")) # 2 minas 5 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_3.png")) # 3 minas 6 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_4.png")) # 4 minas 7 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_5.png")) # 5 minas 8 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_6.png")) # 6 minas 9 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_mina.png")) # hay mina 10 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_boom.png")) # mina explota 11 self.iconos.append(gtk.gdk.pixbuf_new_from_file("ycelda_question.png")) # no se sabe 12 self.numjugada=1 #PARA SI ES EL PRIMER CLICK QUE HACE PARA ABRIR, PARA REASIGNAR UNA MINA self.tpo0=-1 gobject.idle_add(self.tiempo)#Esta función ayuda a que el cronometro funcione
def __init__(self): component.Component.__init__(self, "QueuedTorrents", depend=["StatusBar", "AddTorrentDialog"]) self.queue = [] self.status_item = None self.config = ConfigManager("gtkui.conf") self.builder = gtk.Builder() self.builder.add_from_file( deluge.common.resource_filename( "deluge.ui.gtkui", os.path.join("glade", "queuedtorrents.ui"))) self.builder.get_object("chk_autoadd").set_active( self.config["autoadd_queued"]) self.dialog = self.builder.get_object("queued_torrents_dialog") self.dialog.set_icon(common.get_logo(32)) self.builder.connect_signals({ "on_button_remove_clicked": self.on_button_remove_clicked, "on_button_clear_clicked": self.on_button_clear_clicked, "on_button_close_clicked": self.on_button_close_clicked, "on_button_add_clicked": self.on_button_add_clicked, "on_chk_autoadd_toggled": self.on_chk_autoadd_toggled }) self.treeview = self.builder.get_object("treeview") self.treeview.append_column( gtk.TreeViewColumn(_("Torrent"), gtk.CellRendererText(), text=0)) self.liststore = gtk.ListStore(str, str) self.treeview.set_model(self.liststore)
def __init__(self, padre=None): builder = gtk.Builder() builder.add_from_file('dlgDespachos.glade') builder.connect_signals(self) self.dialogo = builder.get_object('dialogo') self.despacho_id = builder.get_object('despacho_id') self.empleado_id = builder.get_object('empleado_id') self.empleado = builder.get_object('empleado') self.buscar_empleado = builder.get_object('buscar_empleado') self.nuevo_empleado = builder.get_object('nuevo_empleado') self.agregar = builder.get_object('agregar') self.quitar = builder.get_object('quitar') self.aceptar = builder.get_object('aceptar') self.emision = builder.get_object('emision') self.bruto = builder.get_object('bruto') self.impuestos = builder.get_object('impuestos') self.total = builder.get_object('total') self.tree = builder.get_object('tree') self.lista = builder.get_object('lista') self.tvcell3 = builder.get_object('tvcell3') self.tvcell3.connect('edited', self.tvcell3_edited_cb, self.lista) self.padre = padre if padre is None: self.frm_padre = self.dialogo else: self.frm_padre = self.padre.frm_padre self.bruto.set_text('0,00') self.impuestos.set_text('0,00') self.total.set_text('0,00') self.crear_columnas() self.dialogo.show()
def __init__( self, main_window_ref, general_task_ctrl, source_site, target_sites_list, limit, workers, worker_sleep, ): self.main_window_ref = main_window_ref self.general_task_ctrl = general_task_ctrl self.builder = gtk.Builder() self.builder.add_from_file(TASK_WIDGET_GLADE) self.widget = self.builder.get_object('widget_alignment') self._source_site = source_site self._target_sites_list = target_sites_list self._limit = limit self.log_buffer = ShortHistoryBuffer(LOG_BUFFER_SIZE) self.builder.connect_signals(self) self.builder.get_object('source_site_entry').\ set_text(source_site.encode('utf-8')) self.builder.get_object('target_sites_list_entry').\ set_text(target_sites_list.encode('utf-8')) limit_msg = 'Да, %s' % limit \ if limit is not None else 'Нет (бесконечно)' self.builder.get_object('limit_entry').\ set_text(limit_msg.encode('utf-8')) self.builder.get_object('workers_spinbutton').\ set_value(workers) self.builder.get_object('worker_sleep_spinbutton').\ set_value(worker_sleep)
def __init__(self): builder = gtk.Builder() builder.add_from_file("test.glade") self.window = builder.get_object("window1") self.filechooserdialog1 = builder.get_object("filechooserdialog1") self.filechooserdialog2 = builder.get_object("filechooserdialog2") self.sysinfo_dialog = builder.get_object("messagedialog1") self.disk_space_confirm_dialog = builder.get_object("messagedialog2") self.disk_confirm_dialog = builder.get_object("messagedialog3") self.standard_confirm_dialog = builder.get_object("messagedialog4") self.combo1 = builder.get_object("comboboxentry1") self.combo2 = builder.get_object("comboboxentry2") self.combo3 = builder.get_object("comboboxentry3") self.Calendar1 = builder.get_object("calendar1") self.progressbar1 = builder.get_object("progressbar1") self.progressbar2 = builder.get_object("progressbar2") self.textview1 = builder.get_object("textview1") self.textview2 = builder.get_object("textview2") # self.progressbar1.hide() # self.Calendar1.select_month(get_sys_time()[1] - 1, get_sys_time()[0]) # self.Calendar1.select_day(get_sys_time()[2]) #self.progressbar1.show() #self.progressbar1.set_fraction(0.3) builder.connect_signals(self)
def __init__( self, glade_file=None #None: use default ui , parent=None, width=None, height=None, alive=True, gtk_theme_name="Follow System Theme"): self.alive = alive linuxcnc_running = False if ini_check(): linuxcnc_running = True if (glade_file == None): glade_file = os.path.join(g_ui_dir, 'gremlin_view.ui') bldr = gtk.Builder() try: bldr.add_from_file(glade_file) except glib.GError, detail: print('\nGremlinView:%s\n' % detail) raise glib.GError, detail # re-raise
def __init__(self): self.wTree = gtk.Builder() self.wTree.add_from_file('viewer/gui.xml') dic = { 'on_window_destroy' : self.quit } self.wTree.connect_signals(dic) f = Figure(figsize=(5,4), dpi=100) self.subplot = f.add_subplot(111) self.subplot.grid(True) self.subplot.plot() #self.msgls = gtk.ListStore(gobject.TYPE_PYOBJECT,str,str,str,str) self.msgls = gtk.ListStore(str,str,str,str) self.wTree.get_object('tv_messages').set_model(self.msgls) for colit,colname in enumerate(['device','message','value']): cell = gtk.CellRendererText() col = gtk.TreeViewColumn(colname,cell) col.add_attribute(cell,'text',colit+1) self.wTree.get_object('tv_messages').append_column(col) self.canvas = FigureCanvas(f) self.wTree.get_object('hbox').add(self.canvas) self.wTree.get_object('window').set_default_size(640,480) self.wTree.get_object('window').show_all() gobject.timeout_add(500, self.timer_callback) self.rows = {} self.values = {} self.dbg = 0
def __init__(self): self._gladefile = "neuronview.glade" self._builder = gtk.Builder() self._builder.add_from_file(self._gladefile) self._builder.connect_signals(self) self._win = self._builder.get_object("mainwindow") self._win.resize(900, 700) box = self._builder.get_object("box5") self._stimulatordictview = DictView() self._builder.get_object("scrolledwindow2").add( self._stimulatordictview) box = self._builder.get_object("box4") self._neurondictview = DictView() self._builder.get_object("scrolledwindow3").add(self._neurondictview) self.populate_comboboxes() self._figure = Figure(figsize=(5, 4), dpi=100) canvas = FigureCanvas(self._figure) canvas.set_size_request(200, 250) canvas.show() box = self._builder.get_object("box3") bg_style = box.get_style().bg[gtk.STATE_NORMAL] gtk_color = (bg_style.red_float, bg_style.green_float, bg_style.blue_float) self._figure.set_facecolor(gtk_color) box.pack_start(canvas) self._win.show() gtk.main()
def __init__(self): UI_filename = "ItemReminderGUI.glade" self.builder = gtk.Builder() self.builder.add_from_file(UI_filename) self.builder.connect_signals(self) self.window2 = self.builder.get_object("TestWindow1") self.window2.fullscreen() 'First tag slot' self.item1box = self.builder.get_object("eventbox1") self.item1box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0xFFFF, 0x0000, 0x0000)) #Red self.labelKeys = self.builder.get_object("labelKeys") self.labelKeys.set_markup( '<span size="24000" foreground="#FFFFFF">Keys</span>') 'Second tag slot' self.item2box = self.builder.get_object("eventbox2") self.item2box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0xFFFF, 0xFFFF, 0x0000)) #Yellow self.labelWallet = self.builder.get_object("labelWallet") self.labelWallet.set_markup('<span size="24000">Wallet</span>') 'Third tag slot' self.item3box = self.builder.get_object("eventbox3") self.item3box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0x0000, 0xFFFF, 0x0000)) #Green self.labelPhone = self.builder.get_object("labelPhone") self.labelPhone.set_markup('<span size="24000">Mobile Phone</span>') 'These used for the state of the text' self.x = 0 self.y = 0 self.z = 0 self.g = 0
def __init__(self): self.filename = "InterfaceGTKGlade.glade" self.builder = gtk.Builder() self.builder.add_from_file(self.filename) self.window = self.builder.get_object("MainWindow") #self.window.fullscreen() dic = { #"on_quantity_spinner_edited" : self.quantitySpinnerEdited, "on_start_button_clicked": self.startButtonClicked, "on_page2_fwd_clicked": self.page2FwdClicked, "on_page2_back_clicked": self.page2BackClicked, "on_page3_back_clicked": self.page3BackClicked, "on_MainWindow_destroy": self.quit, "on_increment_button_clicked": self.incrementButtonClicked, "on_decrement_button_clicked": self.decrementButtonClicked, "on_quit_button_clicked": self.quitButtonClicked, "on_page3_quit_clicked": self.purchaseClicked, "on_purchase_button_clicked": self.purchaseClicked } self.builder.connect_signals(dic) # We just init on applicaiton start - and maybe when the user wants to totally empty the cart self.initItemsView()
def __init__(self): gladefile = "HurricaneUI.glade" builder = gtk.Builder() builder.add_from_file(gladefile) self.window = builder.get_object("mainWindow") builder.connect_signals(self) self.figure = Figure(figsize=(10, 10), dpi=75) self.axis = self.figure.add_subplot(111) self.lat = 50 self.lon = -100 self.globe = globDisp.GlobeMap(self.axis, self.lat, self.lon) self.canvas = FigureCanvasGTK(self.figure) self.canvas.show() self.canvas.set_size_request(500, 500) self.globeview = builder.get_object("map") self.globeview.pack_start(self.canvas, True, True) self.navToolbar = NavigationToolbar(self.canvas, self.globeview) self.navToolbar.lastDir = '/var/tmp' self.globeview.pack_start(self.navToolbar) self.navToolbar.show() self.gridcombo = builder.get_object("gridsize") cell = gtk.CellRendererText() self.gridcombo.pack_start(cell, True) self.gridcombo.add_attribute(cell, 'text', 0) #self.gridcombo.set_active(2) # read menu configuration self.gridopt = builder.get_object("gridopt").get_active() self.chkDetected = builder.get_object("detectedopt") self.detectedopt = self.chkDetected.get_active() self.chkHurricane = builder.get_object("hurricaneopt") self.hurricaneopt = self.chkHurricane.get_active() model = builder.get_object("liststore1") index = self.gridcombo.get_active() self.gridsize = model[index][0] radio = [ r for r in builder.get_object("classifieropt1").get_group() if r.get_active() ][0] self.sClassifier = radio.get_label() self.start = builder.get_object("startdate") self.end = builder.get_object("enddate") self.chkUndersample = builder.get_object("undersample") self.chkGenKey = builder.get_object("genKey") # disable unimplemented classifier selection builder.get_object("classifieropt2").set_sensitive(False) builder.get_object("classifieropt3").set_sensitive(False) builder.get_object("classifieropt4").set_sensitive(False) self.btnStore = builder.get_object("store") self.datapath = 'GFSdat' self.trackpath = 'tracks' builder.get_object("btnDatapath").set_current_folder(self.datapath) builder.get_object("btnTrackpath").set_current_folder(self.trackpath) self.btnDetect = builder.get_object("detect") # current operation status self.stormlocs = None self.detected = None self.clssfr = None # for test drawing functions if os.path.exists('demo.detected'): with open('demo.detected', 'r') as f: self.detected = pickle.load(f) self.stormlocs = pickle.load(f) self.chkHurricane.set_label( str(self.stormlocs.shape[0]) + " Hurricanes") self.chkDetected.set_label( str(self.detected.shape[0]) + " Detected") self.setDisabledBtns() # draw Globe self.drawGlobe()
def __init__(self, package=None): logger.info("Creating Recording Area") gtk.Box.__init__(self) builder = gtk.Builder() builder.add_from_file(get_ui_path('recorder.glade')) self.repo = context.get_repository() self.dispatcher = context.get_dispatcher() self.worker = context.get_worker() self.record = None self.current_mediapackage = None self.current = None self.next = None self.restarting = False self.font = None self.scheduled_recording = False self.focus_is_active = False self.net_activity = None self.error_id = None self.error_text = None self.error_dialog = None self.start_id = None # BUILD self.recorderui = builder.get_object("recorderbox") self.main_area = builder.get_object("videobox") self.areas = None self.vubox = builder.get_object("vubox") self.gui = builder # BIG STATUS big_status = builder.get_object("bg_status") self.view = self.set_status_view() big_status.add(self.view) # STATUS BAR self.statusbar = status_bar.StatusBarClass() self.dispatcher.connect("update-rec-status", self.statusbar.SetStatus) self.dispatcher.connect("update-video", self.statusbar.SetVideo) self.dispatcher.connect("galicaster-init", self.check_status_area) self.dispatcher.connect("galicaster-init", self.check_net) self.dispatcher.connect("restart-preview", self.check_status_area) self.dispatcher.connect("net-up", self.check_net, True) self.dispatcher.connect("net-down", self.check_net, False) self.statusbar.SetTimer(0) # VUMETER self.audiobar = AudioBarClass() # UI self.vubox.add(self.audiobar.bar) self.pack_start(self.recorderui, True, True, 0) # Event Manager self.dispatcher.connect("start-record", self.on_scheduled_start) self.dispatcher.connect("stop-record", self.on_scheduled_stop) self.dispatcher.connect("start-before", self.on_start_before) self.dispatcher.connect("restart-preview", self.on_restart_preview) self.dispatcher.connect("update-rec-vumeter", self.audiobar.SetVumeter) self.dispatcher.connect("galicaster-status", self.event_change_mode) self.dispatcher.connect("galicaster-notify-quit", self.close) nb = builder.get_object("data_panel") pages = nb.get_n_pages() for index in range(pages): page = nb.get_nth_page(index) nb.set_tab_label_packing(page, True, True, gtk.PACK_START) # STATES self.status = GC_INIT self.previous = None self.change_state(GC_INIT) self.dispatcher.connect("reload_profile", self.on_recover_from_error) # PERMISSIONS self.conf = context.get_conf() self.allow_pause = self.conf.get_permission("pause") self.allow_start = self.conf.get_permission("start") self.allow_stop = self.conf.get_permission("stop") self.allow_manual = self.conf.get_permission("manual") self.allow_overlap = self.conf.get_permission("overlap") # OTHER builder.connect_signals(self) self.net_activity = self.conf.get_boolean('ingest', 'active') self.change_state(GC_READY) self.proportion = 1 self.on_start() # SCHEDULER FEEDBACK self.scheduler_thread_id = 1 self.clock_thread_id = 1 self.start_thread_id = None self.scheduler_thread = thread(target=self.scheduler_launch_thread) self.clock_thread = thread(target=self.clock_launch_thread) self.scheduler_thread.daemon = True self.clock_thread.daemon = True self.scheduler_thread.start() self.clock_thread.start() self.dispatcher.emit("galicaster-init")