def __init__(self, glade_file_name, presets_store, preset_display_func):
        gobject.GObject.__init__(self)

        glade_widgets = glade.XML(glade_file_name, 'manage_presets_dialog')
        self._dialog = glade_widgets.get_widget('manage_presets_dialog')
        self._presets_view = glade_widgets.get_widget('presets_view')
        self._delete_button = glade_widgets.get_widget('delete_button')
        self._edit_button = glade_widgets.get_widget('edit_button')
        self._add_button = glade_widgets.get_widget('add_button')

        self._presets_view.set_model(presets_store)
        renderer = gtk.CellRendererText()
        col = gtk.TreeViewColumn('Preset', renderer)

        def preset_cell_data_func(col, cell, model, row_iter, user_data=None):
            cell.props.text = preset_display_func(row_iter)

        col.set_cell_data_func(renderer, preset_cell_data_func)
        self._presets_view.append_column(col)

        self._dialog.connect('response', self._on_dialog_response)
        self._dialog.connect('delete-event', self._dialog.hide_on_delete)
        self._presets_view.get_selection().connect(
            'changed', lambda selection: self._update_button_states())
        self._delete_button.connect('clicked', self._on_delete_button_clicked)
        self._edit_button.connect('clicked', self._on_edit_button_clicked)
        self._add_button.connect('clicked', self._on_add_button_clicked)

        self._update_button_states()
        self._dialog.set_default_size(300, 220)
 def __init__(self, glade_file_name, title, name_validator_func,
              name='', hours=0, minutes=0, seconds=0, command='',
              next_timer='', auto_start=False):
     self._valid_name_func = name_validator_func
     
     glade_widgets = glade.XML(glade_file_name, 'add_edit_preset_dialog')
     self._dialog = glade_widgets.get_widget('add_edit_preset_dialog')
     self._ok_button = glade_widgets.get_widget('ok_button')
     self._cancel_button = glade_widgets.get_widget('cancel_button')
     self._name_entry = glade_widgets.get_widget('name_entry')
     duration_chooser_container = glade_widgets.get_widget('duration_chooser_container')
     self._duration_chooser = DurationChooser(gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL))
     self._command_entry = glade_widgets.get_widget('command_entry')
     self._next_timer_entry = glade_widgets.get_widget('next_timer_entry')
     self._auto_start_check = glade_widgets.get_widget('auto_start_check')
     
     duration_chooser_container.pack_start(self._duration_chooser)
     
     self._dialog.set_title(title)
     self._dialog.set_default_response(gtk.RESPONSE_OK)
     self._name_entry.set_text(name)
     self._command_entry.set_text(command)
     self._duration_chooser.set_duration(hours, minutes, seconds)
     self._next_timer_entry.set_text(next_timer)
     self._auto_start_check.set_active(auto_start)
     
     self._name_entry.connect('changed', lambda entry: self._check_for_valid_save_preset_input())
     self._duration_chooser.connect('duration-changed',
                                    lambda chooser: self._check_for_valid_save_preset_input())
     self._duration_chooser.show()
Пример #3
0
def my_app_load():
    gui = glade.XML("example_10.glade")

    # Connect menu items to callbacks
    item = gui.get_widget("menu_quit_item")
    item.connect("activate", lambda arg1: gtk.main_quit())

    item = gui.get_widget("window1")
    item.connect("delete_event", lambda arg1, arg2: gtk.main_quit())

    item = gui.get_widget("menu_print_item")
    item.connect("activate", my_print_cb)

    item = gui.get_widget("menu_print_preview_item")
    item.connect("activate", my_print_preview_cb)

    item = gui.get_widget("menu_print_setup_item")
    item.connect("activate", my_print_setup_cb)

    #     item = gui.get_widget("menu_tree_item")
    #     item.connect("activate", my_tree_cb)

    item = gui.get_widget("menu_font_item")
    item.connect("activate", my_font_dialog_cb)

    app.status_bar = gui.get_widget("statusbar")
    app.doc1 = my_new_doc("doc1", gui)
    if 0:
        app.doc2 = my_new_doc("doc2", gui)
        app.doc3 = my_new_doc("doc3", gui)
    app.active_doc = None
    app.doc1.view.grab_focus()

    return True
Пример #4
0
    def _create_gui(self):
        gui = glade.XML('gnxui.glade', 'main_window')

        get_widget = gui.get_widget

        self.main_window = get_widget('main_window')
        self.main_window.connect('delete-event', gtk.main_quit)

        self.user = get_widget('user')
        self.user.connect('activate', self._connect_session_cb)

        self.password = get_widget('password')
        self.password.connect('activate', self._connect_session_cb)

        session = get_widget('session')
        session.connect('changed', self._session_changed_cb)
        self.session = session

        self._prepare_session_combo(session)
        self._update_sessions()

        new_btn = get_widget('new_btn')
        new_btn.connect('clicked', self._new_session_cb)

        modify_btn = get_widget('modify_btn')
        modify_btn.connect('clicked', self._modify_session_cb)

        connect_btn = get_widget('connect_btn')
        connect_btn.connect('clicked', self._connect_session_cb)
        connect_btn.grab_focus()

        self.gui = gui
Пример #5
0
 def __init__(self, gladeFile):
     """Setup the appropriate signal handlers and call setHandlers."""
     if not self._signalsAreDone:
         self._signalsAreDone = True
         signal.signal(signal.SIGINT, signal.SIG_DFL)
     self.xml = glade.XML(gladeFile)
     self.setHandlers()
Пример #6
0
    def _construct_config_dialog (self):
        """
        Builds the D-Bus plugin basic configuration dialog, and returns the
        glade.XML object for it.

        You'll want to use this in case you override create_config_dialog to
        add your own custom widgets to the dialog.  The "content" widget is a
        VBox you can add you own widgets to.
        """

        xml = glade.XML (os.path.join (musicapplet.defs.PKG_DATA_DIR, "dbus.glade"))
        dialog = xml.get_widget ("dbus-dialog")

        dialog.set_title (_("%s Plugin") % self.player_name)

        full_key = self._conf.resolve_plugin_key (self, "launch")
        self._conf.bind_string_boolean (full_key, "D-Bus", xml.get_widget ("lu-dbus"), "active")
        self._conf.bind_string_boolean (full_key, "Command", xml.get_widget ("lu-command"), "active")
        self._conf.bind_string_boolean (full_key, "Command", xml.get_widget ("command"), "sensitive")
        self._conf.bind_string_boolean (full_key, "Command", xml.get_widget ("browse"), "sensitive")

        full_key = self._conf.resolve_plugin_key (self, "command")
        self._conf.bind_string (full_key, xml.get_widget ("command"), "text")

        xml.get_widget ("browse").connect ("clicked", lambda button: self._browse_for_command (dialog))
        dialog.set_default_response (gtk.RESPONSE_CLOSE)
        dialog.connect ("response", lambda dialog, response: dialog.hide ())

        return xml
Пример #7
0
    def create_window(self):
        gdk.threads_enter()
        try:
            wTree = glade.XML ("gtklb.glade", "main")

            dic = {"on_new_activate": self.on_new_activate,
                   "on_open_activate": self.on_open_activate,
                   "on_save_activate": self.on_save_activate,
                   "on_save_as_activate": self.on_save_as_activate,
                   "on_properties_activate": self.on_properties_activate,
                   "on_exit_activate": self.on_exit_activate}
                   
            wTree.signal_autoconnect (dic)

            w = wTree.get_widget("main")

            self.window=w
            self.windowTree=wTree
            self.menubar = wTree.get_widget("menubar")

            self.textbox=wTree.get_widget("outputText")
            self.more_toggle=wTree.get_widget("entryMore")
            self.entry=wTree.get_widget("entry")

            self.entry.connect('activate', self.entry_activated, None)
            self.entry.connect('key_press_event', self.key_pressed, None)

        finally:
            gdk.threads_leave()
Пример #8
0
 def init(self, glade_file_name=None, top_level_name=None):
     assert (self.glade_file_name
             or glade_file_name, 'must provide a glade file')
     if glade_file_name is None:
         glade_file_name = self.glade_file_name
     else:
         self.glade_file_name = glade_file_name
     glade_file = self.__find_gladefile(glade_file_name)
     if not glade_file:
         self.service.log.info('glade file not found %s', glade_file)
         not_found = gtk.Label('this glade file was not found')
         self.widget.pack_start(not_found)
         return
     gtk.glade.set_custom_handler(self.__get_custom_handler)
     glade_build = glade.XML(glade_file)
     self.__auto_connect(glade_build)
     if top_level_name is None:
         top_level_name = self.top_level_name
     else:
         self.top_level_name = top_level_name
     top_level = glade_build.get_widget(self.top_level_name)
     if top_level.get_parent() is not None:
         top_level.unparent()
     self.widget.pack_start(top_level)
     top_level.show_all()
     self.__glade_build = glade_build
     self.init_glade()
Пример #9
0
 def __init__(self, strlist, txt=None, title=None, multiple=0, parent=None):
     self.choice = None
     try:
         gladefile = __file__.split("/")
         gladefile[-1] = "selectionbox.glade"
         gladefile = string.join(gladefile, "/")
     except:
         gladefile = "selectionbox.glade"
     self.gladetree = glade.XML(gladefile)
     self.sigdict = {
         "on_window1_delete_event": self.on_quit,
         "on_window1_destroy_event": self.on_quit,
         "on_buttonCancel_clicked": self.on_quit,
         "on_buttonOK_clicked": self.on_ok
     }
     self.gladetree.signal_autoconnect(self.sigdict)
     self.strlist = strlist
     self.multiple = multiple
     if title == None:
         self.title = "Selection box"
     else:
         self.title = title
     self.gladetree.get_widget("window1").set_title(self.title)
     if parent != None:
         self.gladetree.get_widget("window1").set_transient_for(parent)
     if txt != None:
         self.gladetree.get_widget("labelMsg").set_text(txt)
     self.treeView = self.gladetree.get_widget("treeviewModuleList")
     self.treeStore = gtk.TreeStore(str)
     if self.multiple:
         self.treeView.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
     self.updateList()
     gtk.main()
Пример #10
0
    def __init__(self, app):
        """'Constructor' la objeto de la interfaz grafica."""
        self.companias = {0:"@sms.movistar.net.ar", 1:"@sms.cmail.com.ar"}
        self.app = app
        self.glade = glade.XML("Interfaz.glade")
        self.glade.signal_autoconnect(self)
        self.glade.get_widget("window1").maximize()
        self.temp_label = self.glade.get_widget("label5")  #temperatura
        self.ph_label = self.glade.get_widget("label6")  #pH
        self.o2_label = self.glade.get_widget("label7")  #O2
        self.label10 = self.glade.get_widget("label10")#Recirculacion
        self.label11 = self.glade.get_widget("label11")#Caldera
        self.entry1 = self.glade.get_widget("entry1")#celular
        self.entry2 = self.glade.get_widget("entry2")#e-mail
        self.checkbutton1 = self.glade.get_widget("checkbutton1")
        self.checkbutton2 = self.glade.get_widget("checkbutton2")
        self.combobox1 = self.glade.get_widget("combobox1") #compania celular
        self.contenedor = self.glade.get_widget ("vbox8") #contenedor
        self.combobox1.set_active(0)
        self.image1 = self.glade.get_widget("image1")#Recirculacion
        self.image2 = self.glade.get_widget("image2")#Recirculacion
        
        self.entry1.set_text(''.join(open('conf/telefono')).replace('\n',''))
        self.entry2.set_text(''.join(open('conf/email')).replace('\n',''))

        self.show_all()
Пример #11
0
    def __init__(self, app):
        gtk.VBox.__init__(self)
        Plugin.__init__(self)

        self.app = app
        self.dir = os.path.dirname(__file__)
        self.status = STATUS_STOP

        fname = os.path.join(self.dir, 'vehicle.glade')
        self._glade = glade.XML(fname, 'vehicle_info_box')
        main_vbox = self._glade.get_widget('vehicle_info_box')
        self.pack_start(main_vbox)
        main_vbox.show_all()

        self._vehicle_name = self._glade.get_widget('vehicle_name_data')
        self._vehicle_plate = self._glade.get_widget('vehicle_plate_data')
        self._vehicle_make = self._glade.get_widget('vehicle_make_data')
        self._vehicle_model = self._glade.get_widget('vehicle_model_data')
        self._vehicle_year = self._glade.get_widget('vehicle_year_data')
        self._vehicle_vin = self._glade.get_widget('vehicle_vin_data')
        self._vehicle_engine = self._glade.get_widget('vehicle_engine_data')
        self._vehicle_fuel = self._glade.get_widget('vehicle_fuel_data')
        self._vehicle_obd = self._glade.get_widget('vehicle_obd_data')
        self._vehicle_last_connect = self._glade.get_widget(
            'vehicle_last_connect_data')

        alignment = gtk.Alignment(0, 0, 0, 0)
        self.layout = gtk.Layout()
        alignment.add(self.layout)
        self.pack_start(alignment, True, True)
        self.show_all()

        self._reset_cbid = app.connect("reset", self._on_reset)
        self._switch_cbid = app.notebook.connect('switch-page',
                                                 self._notebook_page_change_cb)
Пример #12
0
    def __init__(self, deferred, netclient, fps):
        self.fps = fps
        self.deferred = deferred
        self.netclient = netclient

        self.glade = glade.XML(fs.gladefile)
        self.glade.signal_autoconnect(self)

        drawing = self.gw_drawingarea1
        drawing.connect('map-event', sdlHack)

        # coordinate and scale for displaying the model
        self.scale = 1.0
        self.corner = (0, 0)

        # start updating pygame after map-event has occurred
        reactor.callLater(0.1, self.mainScreenTurnOn)

        # force size_allocate hook to get called, and draw on the display
        da_w = self.gw_drawingarea1.get_allocation().width
        da_h = self.gw_drawingarea1.get_allocation().height
        reactor.callLater(
            0.15, lambda: self.on_drawingarea1_size_allocate(
                self.gw_drawingarea1, gtk.gdk.Rectangle(0, 0, da_w, da_h)))

        self.model = None
Пример #13
0
    def __init__(self):

        ui = "auction-client.glade"
        self.widget_tree = glade.XML(ui, "window")

        signals = {
            "on_quit_clicked": self.quit,
            "on_save_clicked": self.save,
            "on_load_clicked": self.load,
            "on_connect_clicked": self.connect,
            "on_buyer_toggled": self.buyer_toggled
        }
        self.widget_tree.signal_autoconnect(signals)

        hbox = self.widget_tree.get_widget("scales")
        self.scales = []
        for price in range(PRICES):
            scale = gtk.VScale(
                gtk.Adjustment(TRADE_MAX // 2, 0, TRADE_MAX, 1,
                               TRADE_MAX // 10))
            scale.set_draw_value(True)
            scale.set_value_pos(gtk.POS_BOTTOM)
            scale.set_inverted(True)
            scale.set_digits(0)
            scale.connect('value-changed', self.scale_changed)

            self.scales.append(scale)
            hbox.add(scale)
        hbox.show_all()

        # Used when changing the scales en-mass
        self.enforce_monotonic_scales = True
Пример #14
0
    def __init__(self, parent=None):
        self.glade = glade.XML(common.terp_path("openerp.glade"),
                               'win_preference', gettext.textdomain())
        self.win = self.glade.get_widget('win_preference')
        self.win.set_icon(common.OPENERP_ICON)
        if not parent:
            parent = service.LocalService('gui.main').window
        self.win.set_transient_for(parent)
        self.parent = parent

        action_id = rpc.session.rpc_exec_auth('/object', 'execute',
                                              'res.users', 'action_get', {})
        action = rpc.session.rpc_exec_auth('/object', 'execute',
                                           'ir.actions.act_window', 'read',
                                           [action_id], False,
                                           rpc.session.context)[0]

        view_ids = []
        if action.get('views', []):
            view_ids = [x[0] for x in action['views']]
        elif action.get('view_id', False):
            view_ids = [action['view_id'][0]]

        self.screen = Screen('res.users', view_type=[], window=parent)
        self.screen.add_view_id(view_ids[0], 'form', display=True)
        self.screen.load([rpc.session.uid])
        self.screen.display(rpc.session.uid)

        vbox = self.glade.get_widget('preference_vbox')
        vbox.pack_start(self.screen.widget)

        self.win.set_title(_('Preferences'))
        self.win.show_all()
Пример #15
0
def bug_report(master_window, gladefile, trace):
    """
    Send the user to a bug report webpage, instructing him to paste a template
    with questions and diagnostics information.
    
    master_window: gtk.Window, master of the dialog.
    gladefile: glade filename, for getting the widgets.
    trace: a string with the formatted traceback, or None.
    """
    xml = glade.XML(gladefile, 'bug_report_dialog')
    d = xml.get_widget('bug_report_dialog')
    bug_report_textview = xml.get_widget('bug_report_textview')
    update_label = xml.get_widget('update_label')
    d.set_transient_for(master_window)
    d.set_default_response(gtk.RESPONSE_OK)

    prefilled = get_prefilled(trace)
    tb = bug_report_textview.get_buffer()
    tb.set_text(prefilled)
    update_msg = get_update_message()
    if update_msg:
        update_label.set_markup(update_msg)
        update_label.show()
    clipboard = gtk.Clipboard()
    clipboard.set_text(prefilled)

    r = d.run()
    d.destroy()

    if r == gtk.RESPONSE_OK:
        webbrowser.open('https://github.com/noamraph/dreampie/issues/new')
Пример #16
0
def selection(title, values, alwaysask=False, parent=None):
    if not values or len(values) == 0:
        return None
    elif len(values) == 1 and (not alwaysask):
        key = values.keys()[0]
        return (key, values[key])

    xml = glade.XML(terp_path("openerp.glade"), "win_selection",
                    gettext.textdomain())
    win = xml.get_widget('win_selection')
    if not parent:
        parent = service.LocalService('gui.main').window
    win.set_icon(OPENERP_ICON)
    win.set_transient_for(parent)

    label = xml.get_widget('win_sel_title')
    if title:
        label.set_text(title)

    list = xml.get_widget('win_sel_tree')
    list.get_selection().set_mode('single')
    cell = gtk.CellRendererText()
    column = gtk.TreeViewColumn("Widget", cell, text=0)
    list.append_column(column)
    list.set_search_column(0)
    model = gtk.ListStore(gobject.TYPE_STRING)
    keys = values.keys()
    keys.sort()

    for val in keys:
        model.append([val])

    list.set_model(model)
    list.connect('row-activated',
                 lambda x, y, z: win.response(gtk.RESPONSE_OK) or True)

    ok = False
    while not ok:
        response = win.run()
        ok = True
        res = None
        if response == gtk.RESPONSE_OK:
            sel = list.get_selection().get_selected()
            if sel:
                (model, iter) = sel
                if iter:
                    res = model.get_value(iter, 0)
                    try:
                        res = (res, values[res.decode('utf8')])
                    except:
                        res = (res, values[res])
                else:
                    ok = False
            else:
                ok = False
        else:
            res = None
    parent.present()
    win.destroy()
    return res
Пример #17
0
 def __init__(self):
     self.xml = glade.XML("prueba.glade", None, None)
     self.xml.signal_connect("send_b_clicked_cb", self.send)
     self.xml.signal_connect("mainwindow_destroy_cb", gtk.main_quit)
     self.ttl = self.xml.get_widget("ttl_value")
     self.src = self.xml.get_widget("src_value")
     self.dst = self.xml.get_widget("dst_value")
Пример #18
0
    def __init__(self, app):
        gtk.VBox.__init__(self)
        Plugin.__init__(self)

        self.app = app
        self.dir = os.path.dirname(__file__)
        self.status = STATUS_STOP

        fname = os.path.join(self.dir, 'dtc_lookup.glade')
        self._glade = glade.XML(fname, 'hpaned')

        self._dtc_info = DTCInfo(self._glade)

        button = self._glade.get_widget('re-read-button')
        button.connect('clicked', self._reread_button_clicked)

        button = self._glade.get_widget('dtc-lookup-button')
        button.connect('clicked', self._dtclookup_button_clicked)

        hpaned = self._glade.get_widget('hpaned')
        self.pack_start(hpaned, True, True)
        hpaned.set_border_width(5)

        self.dtc_enter = self._glade.get_widget('dtc_entry')
        self.dtc_enter.connect('activate', self._dtclookup_button_clicked)

        self.show_all()

        self._reset_cbid = app.connect("reset", self._on_reset)
        self._switch_cbid = app.notebook.connect('switch-page',
                                                 self._notebook_page_change_cb)
Пример #19
0
    def __init__(self, xml):
        """ Sets up the gui, callback, and widget handles """

        # --------------------------------------------------------------------------- #
        # Action Handles
        # --------------------------------------------------------------------------- #
        self.tree    = glade.XML(xml)
        self.bstart  = self.tree.get_widget("startBtn")
        self.bhelp   = self.tree.get_widget("helpBtn")
        self.bclose  = self.tree.get_widget("quitBtn")
        self.window  = self.tree.get_widget("window")
        self.tdevice = self.tree.get_widget("fileTxt")
        self.tsubnet = self.tree.get_widget("addressTxt")
        self.tnumber = self.tree.get_widget("deviceTxt")

        # --------------------------------------------------------------------------- #
        # Actions
        # --------------------------------------------------------------------------- #
        actions = {
            "on_helpBtn_clicked"  : self.help_clicked,
            "on_quitBtn_clicked"  : self.close_clicked,
            "on_startBtn_clicked" : self.start_clicked,
            "on_file_changed"     : self.file_changed,
            "on_window_destroy"   : self.close_clicked
        }
        self.tree.signal_autoconnect(actions)
        if not root_test():
            self.error_dialog("This program must be run with root permissions!", True)
Пример #20
0
def create_preferences_dialog(conf):
    """
    Create a dialog for configuring general applet preferences.
    """

    xml = glade.XML(
        os.path.join(musicapplet.defs.PKG_DATA_DIR, "preferences.glade"))

    full_key = conf.resolve_key("show_song_information")
    conf.bind_boolean(full_key, xml.get_widget("show-song-information"),
                      "active")

    full_key = conf.resolve_key("show_rating")
    conf.bind_boolean(full_key, xml.get_widget("show-rating"), "active")

    full_key = conf.resolve_key("show_time")
    conf.bind_boolean(full_key, xml.get_widget("show-time"), "active")

    full_key = conf.resolve_key("show_controls")
    conf.bind_boolean(full_key, xml.get_widget("show-controls"), "active")

    full_key = conf.resolve_key("show_notification")
    conf.bind_boolean(full_key, xml.get_widget("show-notification"), "active")
    try:
        import pynotify
    except ImportError:
        xml.get_widget("show-notification").set_sensitive(False)

    xml.get_widget("preferences-dialog").set_default_response(
        gtk.RESPONSE_CLOSE)
    xml.get_widget("preferences-dialog").connect(
        "response", lambda dialog, response: dialog.hide())
    return xml.get_widget("preferences-dialog")
Пример #21
0
    def _connect_session_cb(self, *args):
        config = self.config
        config.save()

        self.main_window.hide()
        _update_gui()

        config.username = self.user.get_chars(0, -1)
        config.password = self.password.get_chars(0, -1)

        client = NXClient(config)
        self.client = client

        # FIXME, this should be recorded in a log
        client.log = sys.stdout
        client._yes_no_dialog = self._yes_no_dialog
        client._update_connection_state = self._update_connection_state

        dialog_gui = glade.XML('gnxui.glade', 'con_progress')

        # this dialog will be destroyed when the connection state
        # goes to 'RUNNING'"
        self.state_dialog = dialog_gui.get_widget('con_progress')
        self.state = dialog_gui.get_widget('state_label')
        stop_btn = dialog_gui.get_widget('stop_btn')
        stop_btn.connect('clicked', self._cancel_connect_cb)

        self.state.set_text(_('Initializing...'))
        self.state_dialog.show_all()
        _update_gui()

        client.connect()
        client.start_session()

        gtk.main_quit()
Пример #22
0
    def __init__(self, deferred, netclient):
        self.deferred = deferred
        self.netclient = netclient

        # load glade and connect it to self's dictionary for signal handling
        # This needs to happen as early as possible.
        self.glade = glade.XML(fs.gladefile)
        self.glade.signal_autoconnect(self)

        self._drawDefaultBackground()

        # graphics setup
        self.gw_Vellum.set_icon_from_file(fs('pixmaps', 'v.ico'))

        # set one button icon that isn't stock
        _hand_pb = gdk.pixbuf_new_from_file(fs('pixmaps', 'stock_stop.png'))
        _image = gtk.Image()
        _image.set_from_pixbuf(_hand_pb)
        _image.show()
        self.gw_pan_on.set_icon_widget(_image)

        # objects to be named later
        self.canvas = None
        self.model = None
        self.tool_active = None
        self.active_operation = None
        self.mini_operation = None  # currently only zoom supported

        # stateful operations that have mouse interactivity
        self.operations = {
            'pan_on': Pan,
            'paint_on': Paint,
            'magnify_on': Magnify,
        }
Пример #23
0
    def __init__(self):
        #parse referente al XML remplace ".glade" por el nombre
        #del archivo generado por glade que usara
        self.xml = glade.XML('calc.glade')

        #Aplicacion principal
        #llame aqui a todas las ventanas que utilizara por ejemplo:
        self.frm_main = frm_main.Form(self.xml)
Пример #24
0
 def __init_ui(self, name):
     self.__init_gettext()
     glade_file = path.join(path.dirname(__file__), GLADE_FILE)
     self.__xml = glade.XML(glade_file, name)
     self.__init_options()
     self.window = self.__xml.get_widget(name)
     self.__xml.signal_autoconnect(self)
     self.window.show_all()
Пример #25
0
    def __init__(self, window, parent, model, attrs={}):
        interface.widget_interface.__init__(self, window, parent, model, attrs)

        self.act_id = int(attrs['name'])
        res = rpc.session.rpc_exec_auth('/object', 'execute',
                                        'ir.actions.actions', 'read',
                                        [self.act_id], ['type'],
                                        rpc.session.context)
        if not res:
            raise Exception, 'ActionNotFound'
        type = res[0]['type']
        self.action = rpc.session.rpc_exec_auth('/object', 'execute', type,
                                                'read', [self.act_id], False,
                                                rpc.session.context)[0]
        if 'view_mode' in attrs:
            self.action['view_mode'] = attrs['view_mode']

        if self.action['type'] == 'ir.actions.act_window':
            if not self.action.get('domain', False):
                self.action['domain'] = '[]'
            if attrs.get('domain', False):
                self.action['domain'] = attrs.get('domain')
            self.context = {'active_id': False, 'active_ids': []}
            self.context.update(
                tools.expr_eval(self.action.get('context', '{}'),
                                self.context.copy()))
            self.domain = tools.expr_eval(self.action['domain'],
                                          self.context.copy())
            view_id = []
            if self.action['view_id']:
                view_id = [self.action['view_id'][0]]
            if self.action['view_type'] == 'form':
                mode = (self.action['view_mode'] or 'form,tree').split(',')
                self.screen = Screen(self.action['res_model'],
                                     view_type=mode,
                                     context=self.context,
                                     view_ids=view_id,
                                     domain=self.domain)
                self.win_gl = glade.XML(common.terp_path("openerp.glade"),
                                        'widget_paned', gettext.textdomain())

                self.win_gl.signal_connect('on_switch_button_press_event',
                                           self._sig_switch)
                self.win_gl.signal_connect('on_search_button_press_event',
                                           self._sig_search)
                self.win_gl.signal_connect('on_open_button_press_event',
                                           self._sig_open)
                label = self.win_gl.get_widget('widget_paned_lab')
                label.set_text(
                    attrs.get('string', self.screen.current_view.title))
                vbox = self.win_gl.get_widget('widget_paned_vbox')
                vbox.add(self.screen.widget)
                self.widget = self.win_gl.get_widget('widget_paned')
                self.widget.set_size_request(int(attrs.get('width', -1)),
                                             int(attrs.get('height', -1)))
            elif self.action['view_type'] == 'tree':
                pass  #TODO
Пример #26
0
    def __init__ (self, locations):
        # By default use burnproof
        self.__write_flags = nautilusburn.RECORDER_WRITE_BURNPROOF
        # Sets up data dir and version
        self.version = release.version

        # setup ui
        filename = locations.get_data_file("serpentine.glade")
        g = glade.XML (filename, "preferences_dialog")
        self.__dialog = g.get_widget ("preferences_dialog")
        self.dialog.connect ("destroy-event", self.__on_destroy)
        self.dialog.set_title ("")
        
        # Drive selection
        drv = g.get_widget ("drive")
        cmb_drv = nautilusburn.DriveSelection ()
        cmb_drv.set_property ("show-recorders-only", True)
        cmb_drv.show ()
        
        self.__drive_selection = cmb_drv
        drv.pack_start (cmb_drv, False, False)
        
        # Speed selection
        self.__speed = WriteSpeed(g, self.__drive_selection.get_drive)
        
        # eject checkbox
        self.__eject = gaw.data_toggle_button (g.get_widget ("eject"),
                                               GCONF_DIR + "/eject")
        
        # use gap checkbox
        self.__use_gap = gaw.data_toggle_button (
            g.get_widget ("use_gap"),
            GCONF_DIR + "/use_gap",
            default = True
        )
        
        # temp
        ncb_temp_dir = NCB_GCONF_DIR + "/temp_iso_dir"
        gconf.client_get_default ().add_dir (ncb_temp_dir, gconf.CLIENT_PRELOAD_NONE)
        self.__tmp = gaw.GConfValue (
            key = ncb_temp_dir,
            data_spec = gaw.Spec.STRING,
            default = "file:///tmp"
        )
        
        # debug
        self.__debug = gaw.GConfValue (
            key = GCONF_DIR + "/debug_mode",
            data_spec = gaw.Spec.BOOL,
            default = False
        )
        
        # Pool
        self.__pool = GvfsMusicPool ()
        
        # Close button
        self.__close_button_handler = HideCloseButton(g.get_widget("close_btn"))
Пример #27
0
    def __init__(self, glade_file_name, name_validator_func, presets_store, preset_display_func):
        gobject.GObject.__init__(self)

        self._valid_name_func = name_validator_func;
        self._presets_store = presets_store
        self._preset_display_func = preset_display_func
        
        self._presets_list = ScrollableButtonList()
        labels_size_group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
        self._duration_chooser = DurationChooser(labels_size_group)
        
        glade_widgets = glade.XML(glade_file_name, 'start_timer_dialog')
        self._dialog = glade_widgets.get_widget('start_timer_dialog')
        self._ok_button = glade_widgets.get_widget('ok_button')
        name_label = glade_widgets.get_widget('name_label')
        self._name_entry = glade_widgets.get_widget('name_entry')
        self._save_button = glade_widgets.get_widget('save_button')
        duration_chooser_container = glade_widgets.get_widget('duration_chooser_container')
        presets_chooser_container = glade_widgets.get_widget('presets_chooser_container')
        self._presets_section = glade_widgets.get_widget('presets_section')
        #: The TextEntry control for running a custom command
        self._command_entry = glade_widgets.get_widget('command_entry')
        #: The "Invalid Command" label
        self._invalid_cmd_label = glade_widgets.get_widget('invalid_command_label')
        #: The next timer combo box
        self._next_timer_combo = glade_widgets.get_widget('next_timer_combo_entry')
        self._next_timer_combo.set_model(self._presets_store)
        self._next_timer_combo.set_text_column(0) # The column to be shown
        #: The auto-start check button.
        self._auto_start_check = glade_widgets.get_widget('auto_start_check')
        
        labels_size_group.add_widget(name_label)
        self._dialog.set_default_response(gtk.RESPONSE_OK)
        duration_chooser_container.pack_start(self._duration_chooser)
        presets_chooser_container.pack_start(self._presets_list)
        
        self._dialog.connect('response', self._on_dialog_response)
        self._dialog.connect('delete-event', self._dialog.hide_on_delete)
        self._dialog.add_events(gdk.BUTTON_PRESS_MASK)
        self._duration_chooser.connect('duration-changed', self._on_duration_changed)
        self._name_entry.connect('changed', self._on_name_entry_changed)
        self._save_button.connect('clicked', self._on_save_button_clicked)
        # Check that executable is valid while inserting text
        self._command_entry.connect('changed', self._check_is_valid_command)
        self._next_timer_combo.child.connect("changed",
                                self._on_next_timer_combo_entry_child_changed)
        glade_widgets.get_widget('manage_presets_button').connect('clicked',
                                                                  self._on_manage_presets_button_clicked)
        self._presets_store.connect('row-deleted',
                                    lambda model, row_path: self._update_presets_list())
        self._presets_store.connect('row-changed',
                                    lambda model, row_path, row_iter: self._update_presets_list())
        
        self._update_presets_list()
        self._duration_chooser.show()
        self._presets_list.show()
Пример #28
0
    def __init__(self, deferred):
        self.deferredResult = deferred

        gladefile = util.sibpath(__file__, "pbgtk2login.glade")
        self.glade = glade.XML(gladefile)

        self.glade.signal_autoconnect(self)

        self.setWidgetsFromGladefile()
        self._loginDialog.show()
Пример #29
0
	def __init__(self, window, parent, model, attrs={}):
		interface.widget_interface.__init__(self, window, parent, model, attrs)
		self.win_gl = glade.XML(common.terp_path("picture2.glade"),"widget_picture")
		self.widget = self.win_gl.get_widget('widget_picture')
		self.win_gl.signal_connect('on_picture_but_open_clicked', self.sig_add)
		self.win_gl.signal_connect('on_picture_but_clear_clicked', self.sig_clear)
		self.win_gl.signal_connect('on_picture_but_saveas_clicked', self.sig_save_as)
		#self.wid_text = self.win_gl.get_widget('ent_picture')
		self.wid_picture = self.win_gl.get_widget('widget_picture_view')
		self.value=False
Пример #30
0
    def __init__(self):
        from gtk import glade
        self.glade = glade.XML(self.gladefile)

        # mold can go away when we get a newer pygtk (post 1.99.14)
        mold = {}
        for k in dir(self):
            mold[k] = getattr(self, k)
        self.glade.signal_autoconnect(mold)
        self._setWidgets()