Example #1
0
    def __init__(self, progress_window):
        gobject.GObject.__init__(self)
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        self.bus = dbus.SystemBus()
        self.dbus_object = self.bus.get_object(
            "org.fedoraproject.systemconfig.kdump.mechanism",
            "/org/fedoraproject/systemconfig/kdump/object")

        self.progress_window = progress_window

        # What was on stdout
        self.std = ""

        # What was on stderr
        self.err = ""

        # Which command failed
        self.cmd = ""

        # return code
        self.retcode = 0

        gobject.signal_new("proxy-error", self, gobject.SIGNAL_RUN_FIRST,
                           gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))

        self.loop = gobject.MainLoop()
Example #2
0
    def __init__(self, name, format="%a %b %d %Y", parent_window=None):
        try:
            if not gobject.signal_lookup("on-change-cbcalendar", self):
                gobject.signal_new("on-change-cbcalendar", self,
                                   gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                                   (float, ))
        except:
            pass

        self.format = format
        self._name = name
        self.parent_window = parent_window

        gtk.HBox.__init__(self)

        self.entry = gtk.Entry()
        self.button = gtk.Button()
        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN)
        self.button.add(arrow)

        self.entry.set_editable(False)
        self.button.connect("pressed", self.show_calendar)

        self.pack_start(self.entry, False, False)
        self.pack_start(self.button, False, False)

        self._value = 0

        self.direction = 'down'

        self.show_all()
Example #3
0
    def __init__(self):
        print "Inicio"

        gobject.type_register(Sender)
        gobject.signal_new("z_signal", Sender, gobject.SIGNAL_RUN_FIRST,
                           gobject.TYPE_NONE, ())

        sender = Sender()
        receiver = Reciever(sender)

        sender.connect('z_signal', self.user_callback)
        sender.emit('z_signal')
Example #4
0
    def __init__(self):
        gobject.GObject.__init__(self)
        # A signal all controls can emit when requesting to become active.
        # Right now this means getting control of the AudioControl
        if gobject.signal_lookup('control_request_active', Control) == 0:
            gobject.signal_new('control_request_active', Control,
                               gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [])

        # The control wishes to close
        if gobject.signal_lookup('control_request_close', Control) == 0:
            gobject.signal_new('control_request_close', Control,
                               gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [])
        self._is_active = False
    def __init__(self, initial_value=0, parent_window=None):
        gtk.Dialog.__init__(self)
        try:
            if not gobject.signal_lookup("on-change-calendar-window", self):
                gobject.signal_new("on-change-calendar-window",
                                   self,
                                   gobject.SIGNAL_RUN_LAST,
                                   gobject.TYPE_NONE,
                                   (float,))
        except:
            pass

        self.set_modal(True)
        
        if parent_window:
            parent_window.set_transient_for(self)

        hbox = gtk.HBox()
        self.calendar = gtk.Calendar()
        buttonCurrent = gtk.Button()
        buttonDelete  = gtk.Button()

        buttonCurrent.add(gtk.Label("Current"))
        buttonDelete.add(gtk.Label("Delete"))

        hbox.pack_start(buttonCurrent)
        hbox.pack_start(buttonDelete)

        self.vbox.pack_start(self.calendar, False, False)
        self.vbox.pack_start(hbox)

        self.set_decorated(False)
        self.set_position(gtk.WIN_POS_NONE)
        self.set_property("skip-taskbar-hint", True)

        buttonCurrent.connect("pressed", self.do_select_current)
        buttonDelete.connect("pressed", self.do_select_none)
        self.calendar.connect("day-selected-double-click", self.do_select_day)

        self.connect("focus-out-event", self.do_hide_calendar)

        self.value = initial_value

        # if there are a value, select the day
        if self.value:
            year, month, day, hour, minute, second, dow, doy, isdst = time.localtime(self.value)
            self.calendar.select_month(month-1, year)
            self.calendar.select_day(day)

        self.show_all()
        self.action_area.hide()
Example #6
0
 def __init__(self,
              fichier=os.path.join(os.path.dirname(__file__), "teams.dat"),
              foreground="white"):
     gtk.Label.__init__(self)
     self.set_text("<span foreground='" + foreground + "'>Vide</span>")
     self.set_use_markup(True)  # Mise en forme Markup
     self.team_list = []
     self.fichier = fichier
     self.foreground = foreground
     gobject.signal_new("prompt-message", teamBox, gobject.SIGNAL_RUN_FIRST,
                        gobject.TYPE_NONE, [gobject.TYPE_STRING])
     gobject.signal_new("decrypt-send-teams", teamBox,
                        gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
                        [gobject.TYPE_PYOBJECT])
Example #7
0
    def __init__(self,
                 args=None,
                 bufsize=0,
                 executable=None,
                 stdin=None,
                 stdout=None,
                 stderr=None,
                 preexec_fn=None,
                 close_fds=False,
                 shell=False,
                 cwd=None,
                 env=None,
                 universal_newlines=False,
                 startupinfo=None,
                 creationflags=0,
                 threaded=True,
                 read=80):
        subprocess.Popen.__init__(self,
                                  args=args,
                                  bufsize=bufsize,
                                  executable=executable,
                                  stdin=stdin,
                                  stdout=stdout,
                                  stderr=stderr,
                                  preexec_fn=preexec_fn,
                                  close_fds=close_fds,
                                  shell=shell,
                                  cwd=cwd,
                                  env=env,
                                  universal_newlines=universal_newlines,
                                  startupinfo=startupinfo,
                                  creationflags=creationflags)

        self.sout = []
        self.lock = threading.Lock()

        if not threaded:
            pass
        else:
            try:
                gobject.type_register(self.Sender)
                gobject.signal_new("z_signal", self.Sender,
                                   gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
                                   (object, ))
            except:
                print "Error registering z_signal"

            self.out_pipe, self.err_pipe = self.PipeThread(
                self, self.stdout, read), self.PipeThread(self, self.stderr)
            self.out_pipe.start(), self.err_pipe.start()
Example #8
0
 def register_signals(self, widget):
     """Register gobject signals in a way that avoids multiple inheritance"""
     existing = gobject.signal_list_names(widget)
     for signal in self.signals:
         if signal["name"] in existing:
             dbg("Container:: skipping signal %s for %s, already exists" % (signal["name"], widget))
         else:
             dbg("Container:: registering signal for %s on %s" % (signal["name"], widget))
             try:
                 gobject.signal_new(
                     signal["name"], widget, signal["flags"], signal["return_type"], signal["param_types"]
                 )
             except RuntimeError:
                 err("Container:: registering signal for %s on %s failed" % (signal["name"], widget))
    def __init__(self, initial_value=0, parent_window=None):
        gtk.Dialog.__init__(self)
        try:
            if not gobject.signal_lookup("on-change-calendar-window", self):
                gobject.signal_new("on-change-calendar-window", self,
                                   gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                                   (float, ))
        except:
            pass

        self.set_modal(True)

        if parent_window:
            parent_window.set_transient_for(self)

        hbox = gtk.HBox()
        self.calendar = gtk.Calendar()
        buttonCurrent = gtk.Button()
        buttonDelete = gtk.Button()

        buttonCurrent.add(gtk.Label("Current"))
        buttonDelete.add(gtk.Label("Delete"))

        hbox.pack_start(buttonCurrent)
        hbox.pack_start(buttonDelete)

        self.vbox.pack_start(self.calendar, False, False)
        self.vbox.pack_start(hbox)

        self.set_decorated(False)
        self.set_position(gtk.WIN_POS_NONE)
        self.set_property("skip-taskbar-hint", True)

        buttonCurrent.connect("pressed", self.do_select_current)
        buttonDelete.connect("pressed", self.do_select_none)
        self.calendar.connect("day-selected-double-click", self.do_select_day)

        self.connect("focus-out-event", self.do_hide_calendar)

        self.value = initial_value

        # if there are a value, select the day
        if self.value:
            year, month, day, hour, minute, second, dow, doy, isdst = time.localtime(
                self.value)
            self.calendar.select_month(month - 1, year)
            self.calendar.select_day(day)

        self.show_all()
        self.action_area.hide()
Example #10
0
    def __init__(self):

        super(GoogleSpeechToTextSink, self).__init__()

        self.last_timestamp = None
        self.sinkpad = gst.Pad(self._sinktemplate)
        self.sinkpad.set_setcaps_function(self._sink_setcaps)
        self.sinkpad.set_chain_function(self._sink_chain)
        self.add_pad(self.sinkpad)
        gobject.signal_new('result', self, gobject.SIGNAL_RUN_LAST,
                           gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))
        self.fd = None
        self.timer_event = None
        self.timeout = 0.8  # TODO: Should be a property
Example #11
0
def set_up():
    gobject.type_register(CommandText)
    gobject.type_register(IconSelector)

    gobject.signal_new("text-changed", CommandText, gobject.SIGNAL_RUN_FIRST,
                       gobject.TYPE_NONE, (gobject.TYPE_STRING, ))
    gobject.signal_new("mode-changed", CommandText, gobject.SIGNAL_RUN_FIRST,
                       gobject.TYPE_NONE, (gobject.TYPE_STRING, ))

    gobject.signal_new("image-changed", IconSelector, gobject.SIGNAL_RUN_FIRST,
                       gobject.TYPE_NONE, (gobject.TYPE_STRING, ))
    gobject.signal_new("text-changed", IconSelector, gobject.SIGNAL_RUN_FIRST,
                       gobject.TYPE_NONE, (gobject.TYPE_STRING, ))
    gobject.signal_new("mode-changed", IconSelector, gobject.SIGNAL_RUN_FIRST,
                       gobject.TYPE_NONE, (gobject.TYPE_STRING, ))
Example #12
0
	def __add_signal(self):
		# Add new signal to window.
		from gobject import signal_new, signal_query, SIGNAL_RUN_LAST
		from gobject import TYPE_STRING, TYPE_BOOLEAN, SIGNAL_ACTION
		from gobject import SIGNAL_NO_RECURSE, type_register
		SIGNAL = SIGNAL_ACTION|SIGNAL_RUN_LAST|SIGNAL_NO_RECURSE
		from gtk import Window
		if signal_query("scribes-key-event", Window): return False
		signal_new("scribes-key-event", Window, SIGNAL_ACTION, None, ())
		signal_new("scribes-close-window", Window, SIGNAL, TYPE_BOOLEAN, (TYPE_STRING,))
		signal_new("scribes-close-window-nosave", Window, SIGNAL, TYPE_BOOLEAN, (TYPE_STRING,))
		signal_new("shutdown", Window, SIGNAL, TYPE_BOOLEAN, (TYPE_STRING,))
		signal_new("fullscreen", Window, SIGNAL, TYPE_BOOLEAN, (TYPE_STRING,))
		type_register(type(self.__window))
		return False
Example #13
0
	def setupSignals(self):
		# Definition des signaux
		gobject.signal_new("quitter", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
		gobject.signal_new("waiting-for-this-week", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
		gobject.signal_new("waiting-for-dl-img", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
		gobject.signal_new("waiting-for-params", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
		gobject.signal_new("pb-dl", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ())
		
		# Connection des signaux
		self.connect("destroy", self.doEmit, "quitter")
		self.quitterAction.connect("activate", self.doEmit, "quitter")
		self.parametresAction.connect("activate", self.doEmit, "waiting-for-params")
		self.aboutAction.connect("activate", self.displayAbout)
		self.thisWeek.connect("clicked", self.doEmit, "waiting-for-this-week")
		self.week.connect("changed", self.doEmit, "waiting-for-dl-img")
		self.grp.connect("changed", self.doEmit, "waiting-for-dl-img")
Example #14
0
 def register_signals(self, widget):
     """Register gobject signals in a way that avoids multiple inheritance"""
     existing = gobject.signal_list_names(widget)
     for signal in self.signals:
         if signal['name'] in existing:
             dbg('Container:: skipping signal %s for %s, already exists' %
                 (signal['name'], widget))
         else:
             dbg('Container:: registering signal for %s on %s' %
                 (signal['name'], widget))
             try:
                 gobject.signal_new(signal['name'], widget, signal['flags'],
                                    signal['return_type'],
                                    signal['param_types'])
             except RuntimeError:
                 err('Container:: registering signal for %s on %s failed' %
                     (signal['name'], widget))
Example #15
0
    def __init__(self):
        super(Numpad, self).__init__()

        self.flag = 0
        self.text = ""

        pangoFont = pango.FontDescription("Tahoma 24.2")

        try:
            gobject.signal_new("z_signal", self, gobject.SIGNAL_RUN_FIRST,
                               gobject.TYPE_NONE, (gobject.TYPE_BOOLEAN, ))
        except:
            pass

        self.set_decorated(False)

        self.modify_font(pangoFont)

        self.set_title("Set timeout")

        self.tb = gtk.TextBuffer()
        self.tb.set_text("Set timeout")

        self.set_default_size(MULT * 160, MULT * 90)

        self.tv = gtk.TextView(self.tb)
        self.tv.modify_font(pangoFont)

        self.tv.set_editable(False)
        self.tv.set_border_width(3)

        self.vbox = gtk.VBox()
        self.vbox.add(self.tv)

        self.hbox = {}
        for i in range(KB_ROWS):
            self.hbox[i] = gtk.HBox()
            for j in range(KB_COLS):
                self.button = gtk.Button(label=buttons_ru[i * KB_COLS + j])
                self.button.connect("clicked", self.on_click, i * KB_COLS + j)
                self.hbox[i].add(self.button)
            self.vbox.add(self.hbox[i])

        self.add(self.vbox)
        self.set_position(gtk.WIN_POS_CENTER)
Example #16
0
    def __init__(self, interval=0.0, timeout=0.0, time=0.0):
        """
        Constructor.
        """

        super(Timer, self).__init__()  # Call constructor of super-class

        # Register signals
        gobject.signal_new('timer-updated', Timer, gobject.SIGNAL_RUN_FIRST,
                           gobject.TYPE_NONE, (Timer, ))
        gobject.signal_new('timer-finished', Timer, gobject.SIGNAL_RUN_FIRST,
                           gobject.TYPE_NONE, (Timer, ))

        # Initialize private variables
        self._running = False
        self.interval = interval
        self.timeout = timeout
        self.time = time
Example #17
0
    def _add_tooltip_support(self):
        # Add the "tool tips"
        popup_win = gtk.Window(gtk.WINDOW_POPUP)
        label = gtk.Label()
        popup_win.add(label)

        # pylint: disable=E1101
        if "path-cross-event" not in gobject.signal_list_names(gtk.TreeView):
            gobject.signal_new("path-cross-event", gtk.TreeView,
                               gobject.SIGNAL_RUN_LAST, gobject.TYPE_BOOLEAN,
                               (gtk.gdk.Event, ))

            gobject.signal_new("column-cross-event", gtk.TreeView,
                               gobject.SIGNAL_RUN_LAST, gobject.TYPE_BOOLEAN,
                               (gtk.gdk.Event, ))

            gobject.signal_new("cell-cross-event", gtk.TreeView,
                               gobject.SIGNAL_RUN_LAST, gobject.TYPE_BOOLEAN,
                               (gtk.gdk.Event, ))
        # pylint: enable=E1101

        self.connect("leave-notify-event", self.on_treeview_leave_notify,
                     popup_win)
        self.connect("motion-notify-event", self.on_treeview_motion_notify)

        self.connect("path-cross-event", self.emit_cell_cross_signal)
        self.connect("column-cross-event", self.emit_cell_cross_signal)

        self.connect("cell-cross-event", self.handle_popup, popup_win)

        # Handle double click on a row
        self.connect("row-activated", self.handle_double_click)
Example #18
0
    def __init__(self, center, zoom, tile_loader=None, draggable=True):
        gtk.DrawingArea.__init__(self)
        AbstractMap.__init__(self, center, zoom, tile_loader)

        self.connect("expose_event", self.__expose_event)
        self.connect("configure_event", self.__configure_event)
        self.connect("button_press_event", self.__drag_start)
        self.connect("scroll_event", self.__scroll)
        self.connect("button_release_event", self.__drag_end)
        
        if draggable:
            self.connect("motion_notify_event", self.__drag)
        self.set_events(gtk.gdk.EXPOSURE_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.SCROLL)

        try:
            gobject.signal_new('tile-loader-changed', Map, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))
            gobject.signal_new('map-dragged', Map, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
            gobject.signal_new('draw-marks', Map, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
        except RuntimeError:
            pass

        self.surface_buffer = {}
        self.delay_expose = False

        self.tile_loader_threadpool = threadpool.ThreadPool(openstreetmap.CONCURRENT_THREADS * 2)

        #self.ts = openstreetmap.TileServer(self.tile_loader)

        self.drawing_area_configured = self.drawing_area_arrow_configured = False


        self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
Example #19
0
    def __init__(self,showcontrol=False,dataf="data/", passwd="passwd", imagefile=None, background="black", foreground="white"):
        ## Charge gobject (Important pour ScrollTextBox)
        gobject.signal_new("team-ask-teams",popupWindow,gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [])
        gobject.signal_new("team-update",popupWindow,gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [gobject.TYPE_STRING, gobject.TYPE_BOOLEAN])
        gobject.signal_new("main-enigme", popupWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [gobject.TYPE_INT])

        ## Charge la fenêtre
        gtk.Window.__init__(self)
        self.set_title("Décryptage")
        self.ready = False

        # Definition d'une couleur
        bgcolor = gtk.gdk.color_parse(background)
        self.modify_bg(gtk.STATE_NORMAL, bgcolor)

        ## DecryptBox
        self.decryptbox = DecryptBox(data_folder=dataf, passwd=passwd, imagefile=imagefile, background=background, foreground=foreground)
        self.decryptbox.scrolledlabel.connect("team-update",self.onUpdateTeam)

        ## Affichage
        if showcontrol:
            ## Boutton
            button = gtk.Button(label="start")

            vbox = gtk.VBox()
            vbox.pack_start(self.decryptbox, True, True, 0)
            vbox.pack_start(button, True, True, 0)
            self.add(vbox)
        else:
            self.add(self.decryptbox)

        ## Connexion
        self.connect("destroy", self.quit)
        if showcontrol:
            button.connect("clicked", self.start)
Example #20
0
    def __init__(self,forcebutton=False, size=50):
        ## Initialise gtk.VBox, gtk.HBox
        gtk.VBox.__init__(self)
        hbox = gtk.HBox()

        # Initialisation des variables
        self.size = size
        self.forcebutton = forcebutton
        # Taille des images initiale

        gobject.signal_new("prompt-message",countdownBox,gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [gobject.TYPE_STRING])

        # Création des conteneurs d'images
        self.text = gtk.Label("00:00:40:00")

        # État de l'horloge (0 et 1 = décroissant, 2 = croissant)
        # Permet également le changement de couleur de l'horloge
        self.way = 0

        # Affichage des chiffres
        self.setStartTime()

        # Insertion des chiffres dans le block hbox
        hbox.pack_start(self.text,False,False)

        # Alignement (permet de centrer le coutdown)
        align = gtk.Alignment(0.5, 0.5, 0, 0)
        align.add(hbox)

        # Insertion des chiffres dans le block mère
        self.pack_start(align)
        self.timer = None
        self.playPause = None

        # Show control
        if self.forcebutton:
            self.showControl()
Example #21
0
 def __init__(self,
              settings={},
              number_of_settings=1,
              hidden_on_load=False):
     self.title = None
     self.gobject = gobject.GObject()
     if gobject.signal_lookup('settings-changed', self.gobject) == 0:
         gobject.signal_new(
             "settings-changed", gobject.GObject, gobject.SIGNAL_ACTION,
             gobject.TYPE_NONE,
             (str, gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT))
     if gobject.signal_lookup('loading-settings', self.gobject) == 0:
         gobject.signal_new("loading-settings", gobject.GObject,
                            gobject.SIGNAL_ACTION, gobject.TYPE_NONE,
                            (int, ))
     if gobject.signal_lookup('settings-changed', self.gobject) == 0:
         gobject.signal_new(
             "settings-changed", gobject.GObject, gobject.SIGNAL_ACTION,
             gobject.TYPE_NONE,
             (str, gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT))
     if gobject.signal_lookup('settings-loaded', self.gobject) == 0:
         gobject.signal_new("settings-loaded", gobject.GObject,
                            gobject.SIGNAL_ACTION, gobject.TYPE_NONE,
                            (str, gobject.TYPE_PYOBJECT))
     self.gobject.loading = True
     self.gobject._loaded = False
     self._gui_initialized = False
     self.gobject.number_of_settings = number_of_settings
     if 'hidden_on_load' not in dir(self):
         self.hidden_on_load = hidden_on_load
     self.threading = async .ThreadedClass()
     self.settings = settings
     gtk.VBox.__init__(self)
     self.set_spacing(0)
     if '_build_interface' in dir(self):
         self._build_interface_real = self._build_interface
         self._build_interface = self._build_interface_wrapper
     else:
         self._gui_initialized = True
Example #22
0
        for property in prj:
            setattr(self, property, prj[property])
        self.last_save_fname = fname
        self.unsaved_flag = False
        self.broadcast_change(skip_flag_setting=True)

    def close(self):
        '''
        Close the current project.
        Note that the parameter for the signal is "None" and is a special case
        that each handler must process correctly.
        '''
        self.__reset_project()
        self.emit("project_updated", None)


# These lines register specific signals into the GObject framework.
gobject.type_register(Project)
gobject.signal_new("project_updated", Project, gobject.SIGNAL_RUN_FIRST,
                   gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))
gobject.signal_new("disk_operation_problem", Project, gobject.SIGNAL_RUN_FIRST,
                   gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))


def run_as_script():
    '''Run this code if the file is executed as script.'''
    print('Module executed as script!')


if __name__ == '__main__':
    run_as_script()
Example #23
0
        child = gtk.MenuItem("")
        child.remove(child.child)
        img = ColorTextImage(15, 15, False)
        img.set_bg_color(r, g, b)
        child.add(img)
        child.child.show()
        child.show()
        child.connect("activate", lambda w: self.emit("set_color", (r, g, b)))
        self.attach(child, j, j + 1, i, i + 1)

        self.realize()


gobject.type_register(ColorMenu)
gobject.signal_new("set-color", ColorMenu, gobject.SIGNAL_RUN_LAST,
                   gobject.TYPE_NONE, (object, ))


class ColorTool(gtk.MenuToolButton):
    """Abstract base class for a ColorTool"""
    def __init__(self, icon, default):
        gtk.MenuToolButton.__init__(self, self.icon, "")
        self.icon = icon
        self.connect("clicked", self.use_color)

        self.menu = ColorMenu()
        self.menu.connect("set-color", self.set_color)
        self.set_menu(self.menu)

        self.default = default
        self.color = None
Example #24
0
        if self.posj >= self.width:
            self.posj = 0
            self.posi += 1

    def append(self, item):

        # reset posi, posj
        if self.posj > 0:
            self.posi += 1
            self.posj = 0

        gtk.Menu.append(self, item)

    def add_icon(self, iconfile):

        child = gtk.MenuItem("")
        child.remove(child.child)
        img = gtk.Image()
        iconfile2 = keepnote.gui.lookup_icon_filename(self._notebook, iconfile)
        img.set_from_file(iconfile2)
        child.add(img)
        child.child.show()
        child.show()
        child.connect("activate", lambda w: self.emit("set-icon", iconfile))
        self.append_grid(child)


gobject.type_register(IconMenu)
gobject.signal_new("set-icon", IconMenu, gobject.SIGNAL_RUN_LAST,
                   gobject.TYPE_NONE, (object, ))
Example #25
0
        buy_code = self.buyCodeEntry.get_text()
        subject_win.highlightSubject(buy_code)
        subject_win.connect("subject-selected", self.buyingSubjectSelected)

    def buyingSubjectSelected(self, sender, id, code, name):
        if config.digittype == 1:
            code = utility.convertToPersian(code)
        self.buyCodeEntry.set_text(code)
        sender.window.destroy()

    def selectSellingSubject(self, sender):
        subject_win = subjects.Subjects()
        sell_code = self.sellCodeEntry.get_text()
        subject_win.highlightSubject(sell_code)
        subject_win.connect("subject-selected", self.sellingingSubjectSelected)

    def sellingingSubjectSelected(self, sender, id, code, name):
        if config.digittype == 1:
            code = utility.convertToPersian(code)
        self.sellCodeEntry.set_text(code)
        sender.window.destroy()


gobject.type_register(ProductGroup)
gobject.signal_new("group-selected", ProductGroup, gobject.SIGNAL_RUN_LAST,
                   gobject.TYPE_NONE, (gobject.TYPE_INT, gobject.TYPE_STRING))
gobject.signal_new("item-activated", ProductGroup, gobject.SIGNAL_RUN_LAST,
                   gobject.TYPE_NONE, ())
gobject.signal_new("blank-activated", ProductGroup, gobject.SIGNAL_RUN_LAST,
                   gobject.TYPE_NONE, ())
Example #26
0
	def setupSignals(self):
		# Definition des signaux
		gobject.signal_new("terminated", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ())
		gobject.signal_new("waiting-for-verif-id", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING, gobject.TYPE_STRING))
		gobject.signal_new("verif-id-done", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT,))
		gobject.signal_new("waiting-for-groups", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
		gobject.signal_new("groups-done", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ())
		gobject.signal_new("waiting-for-set-group", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING,))
		gobject.signal_new("set-group-done", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ())
		
		# Connection des signaux
		self.connect("delete-event", self.evtDestroy)
		self.connect("verif-id-done", self.callbackVerifIds)
		self.connect("groups-done", self.callbackRefreshGroup)
		self.connect("set-group-done", self.callbackSelectGroup)
		self.btnQuitter.connect("clicked", self.evtDestroy)
		self.btnFermer.connect("clicked", self.doEmit, "terminated")
		self.btnSuivant.connect("clicked", self.evtSuivant)
		self.champUsername.connect("activate", self.evtSuivant)
		self.champPassword.connect("activate", self.evtSuivant)
		self.tableGroups.connect("row-activated", self.evtSuivant)
Example #27
0
        range = datetime.datetime(*start.timetuple()[:3]), \
                datetime.datetime(*end.timetuple()[:7])

        # Update end if it's a `datetime.date' and not a `datetime.datetime',
        # because day ranges are inclusive (so day must _end_ at 23:59:59)
        if isinstance(end, datetime.date):
            range = range[0], util.end_of_day(range[1])

        if self.range is not None \
          and self.range[0] == range[0] \
          and self.range[1] == range[1]:
            return
        self.range = range
        self.update()


gobject.type_register(CanvasEventView)

gobject.signal_new(
    'time-clicked', CanvasEventView, gobject.SIGNAL_RUN_FIRST,
    gobject.TYPE_NONE,
    (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT))

gobject.signal_new('event-clicked', CanvasEventView, gobject.SIGNAL_RUN_FIRST,
                   gobject.TYPE_NONE,
                   (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT))

gobject.signal_new('event-released', CanvasEventView, gobject.SIGNAL_RUN_FIRST,
                   gobject.TYPE_NONE,
                   (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT))
Example #28
0
 def install_signal(self, signal):
     if not gobject.signal_lookup(signal, self.__class__):
         gobject.signal_new(signal, self.__class__, gobject.SIGNAL_RUN_LAST,
                            gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT, ))
Example #29
0
                    if x.button:
                        x.switch_cancel_button_to_ok()
                        x.button.set_sensitive(1)
                return 0

            gtk.timeout_add(self.finished_lag, finished_cb, self)
            self.polling_timeout = 0
            self.pending_list = []
            return 0

        return 1


#gobject.type_register(PendingView)

gobject.signal_new("finished", PendingView, gobject.SIGNAL_RUN_LAST,
                   gobject.TYPE_NONE, ())

##############################################################################


class PendingView_Simple(PendingView):
    def __init__(self, title, parent=None):
        PendingView.__init__(self,
                             title,
                             parent=parent,
                             self_destruct=1,
                             allow_cancel=0,
                             timeout_len=150)

        self.pending_list = []
Example #30
0
        # Revert color back to normal
        default_bg_color = self.parent.get_style().bg[gtk.STATE_NORMAL]
        self.modify_bg(gtk.STATE_NORMAL, default_bg_color)
        self.unset_flags(gtk.CAN_FOCUS)
        self.active = False
        keybinding = self.getKeybinding()

        if not keybinding:
            self._label.set_text(DEFAULT_TEXT)
        else:
            self._label.set_text(keybinding)


gobject.type_register(KeybindingWidget)
gobject.signal_new("keybinding-changed", KeybindingWidget,
                   gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                   (gobject.TYPE_PYOBJECT, ))

# Tests below


def on_keybinding_changed(widget, keybinding):
    print "on_keybinding_changed()"
    print "New keybinding is", keybinding


if __name__ == '__main__':
    logging.basicConfig()
    log.setLevel(logging.DEBUG)

    win = gtk.Window()
Example #31
0
    def filter_f(self, model, iter):
        if self.tids:
            v = model.get_value(iter, 0)
            if not (v in self.tids):
                return False
        if self.tnames:
            if not (self.tnames.search(model.get_value(iter, 1))):
                return False

        if self.maa.get_value_as_int() > -90:
            if model.get_value(iter, 4) < self.maa.get_value_as_int():
                return False
        return True


gobject.signal_new('constraint-changed', ConstraintsDisplay,
                   gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [])
gobject.signal_new('target-changed', TargetColors, gobject.SIGNAL_RUN_FIRST,
                   gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT])
gobject.signal_new('target-active', TargetColors, gobject.SIGNAL_RUN_FIRST,
                   gobject.TYPE_NONE, [gobject.TYPE_INT])

if __name__ == '__main__':
    l = login.Login()
    l.signon()

    t = SelectDialog(extended=True, withpm=True)
    t.connect('destroy', gtk.main_quit)
    t.run()
Example #32
-1
    def __init__(self, parent, englabel=None, userdict={}, 
                    timeout=10):
        """
        The PTK engine class for embedding in gtk applications. 
        To use create an instance of this or a subclass. 
        It uses the parent object for signals. 
        engine.disconnect() should also be called before the application exits.
        
        Important. 
        It uses the a the gtk mainloop to post/bind events and starts a 
        communications thread, therefore gtk.gdk.threads_init() must be called 
        before the main loop is started!

            gtk.gdk.threads_init()  
            gtk.main()

        Signals to use:
        'engine_disconnect' -  sent went the engine disconnects.

        Methods/attributes you might want to overload:
        _get_welcome()  - Returns a string welcome message.
        self.eng_prompts - these are the prompts used by the controlling console.
        """
        self.parent = parent
        
        #add the engine disconnect signal
        if gobject.signal_lookup("engine_disconnect", self.parent) == 0:
            gobject.signal_new("engine_disconnect", self.parent, 
                               gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,())
        Engine.__init__(self, englabel, userdict, timeout)
    def __init__(self):
        "Create a new GstEditorCanvas."
        goocanvas.CanvasView.__init__(self)
        self.set_size_request(600, 450)
        self.set_bounds(0, 0, 1000, 1000)
        self.show()
        
        #set up the model 
        self.model = goocanvas.CanvasModelSimple()
        self.root = self.model.get_root_item()
        self.set_model(self.model)

        # create a main pipeline to contain all child elements
        self.pipeline = gsteditorelement.PipelineModel()
        
        #set callback to catch new element creation so we can set events
        self.connect("item_view_created", self.onItemViewCreated)
        
        #set callbacks for background clicks
        self.connect_after("button_press_event", self._onButtonPress)
        
        #make our custom signal for deleting elements
        gobject.signal_new("element_delete", gsteditorelement.ElementModel, 
                        gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, 
                        (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT))
        
        #stuff to handle link drag state
        self.currentLink = None
    def Init(self):
        gobject.signal_new('submit_form', Entries, gobject.SIGNAL_RUN_LAST,
                           gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT])

        self.widget_stack = []

        self.InitGUI()
Example #35
-1
 def __init__(self):
     if not gobject.signal_lookup("output", ShellCommandJob):
         gobject.signal_new("output", ShellCommandJob, \
                 gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, \
                 [str])
     if not gtk.main_level():
         gtk.gdk.threads_init()  # _DEBE_ llamarse _ANTES_ del gtk.main por temas del GIL.
    def __init__(self, name, format="%a %b %d %Y", parent_window=None):
        try:
            if not gobject.signal_lookup("on-change-cbcalendar", self):
                gobject.signal_new("on-change-cbcalendar",
                                   self,
                                   gobject.SIGNAL_RUN_LAST,
                                   gobject.TYPE_NONE,
                                   (float,))
        except:
            pass

        self.format = format
        self._name = name
        self.parent_window = parent_window

        gtk.HBox.__init__(self)

        self.entry = gtk.Entry()
        self.button = gtk.Button()
        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN)
        self.button.add(arrow)
        
        self.entry.set_editable(False)
        self.button.connect("pressed", self.show_calendar)
        
        self.pack_start(self.entry, False, False)
        self.pack_start(self.button, False, False)

        self._value = 0
        
        self.direction = 'down'
        
        self.show_all()
Example #37
-1
 def __init__(cls,*kwds):
     gobject.GObjectMeta.__init__(cls,*kwds)
     cls.__gtype_name__ = cls.__name__
     gobject.signal_new('cursor-move', cls,
                        gobject.SIGNAL_RUN_FIRST,
                        gobject.TYPE_NONE,
                        (gobject.TYPE_DOUBLE,gobject.TYPE_DOUBLE))
     gobject.type_register(cls)
Example #38
-1
    def __init__(self, eng):
        super(ScadaTXWin, self).__init__()
        self.eng = eng

        gobject.signal_new("log_to_treeview", ScadaTXWin, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
        self.connect("log_to_treeview", self.append_to_log)

        self.draw_layout()
Example #39
-1
	def __init__(self, pane, interval):
		threading.Thread.__init__(self)
		gobject.GObject.__init__(self)
		self.waitCond = threading.Condition()
		self.daemon = True
		self.pane = pane
		self.stop = False
		glib.timeout_add(interval*60000, self.onTrigger)
		gobject.signal_new("doneFetching", self, gobject.SIGNAL_ACTION, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
Example #40
-1
 def __init__(self,fichier=os.path.join(os.path.dirname(__file__), "teams.dat"),foreground="white"):
     gtk.Label.__init__(self)
     self.set_text("<span foreground='"+foreground+"'>Vide</span>")
     self.set_use_markup(True)   # Mise en forme Markup
     self.team_list = []
     self.fichier = fichier
     self.foreground = foreground
     gobject.signal_new("prompt-message",teamBox,gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [gobject.TYPE_STRING])
     gobject.signal_new("decrypt-send-teams",teamBox,gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT])
Example #41
-1
	def __init__(self, pane, config, sound):
		threading.Thread.__init__(self)
		gobject.GObject.__init__(self)
		gobject.signal_new("alarm", self, gobject.SIGNAL_ACTION, gobject.TYPE_NONE, ())

		self.daemon = True
		self.config = config
		self.pane = pane
		self.sound = sound
Example #42
-1
def set_up():
	gobject.type_register(CommandText)
	gobject.type_register(IconSelector)

	gobject.signal_new("text-changed", CommandText, gobject.SIGNAL_RUN_FIRST,  gobject.TYPE_NONE, (gobject.TYPE_STRING,))
	gobject.signal_new("mode-changed", CommandText, gobject.SIGNAL_RUN_FIRST,  gobject.TYPE_NONE, (gobject.TYPE_STRING,))

	gobject.signal_new("image-changed", IconSelector, gobject.SIGNAL_RUN_FIRST,  gobject.TYPE_NONE, (gobject.TYPE_STRING,))
	gobject.signal_new("text-changed", IconSelector, gobject.SIGNAL_RUN_FIRST,  gobject.TYPE_NONE, (gobject.TYPE_STRING,))
	gobject.signal_new("mode-changed", IconSelector, gobject.SIGNAL_RUN_FIRST,  gobject.TYPE_NONE, (gobject.TYPE_STRING,))
Example #43
-1
	def __init__(self,type=gtk.WINDOW_TOPLEVEL):
		gtk.Window.__init__(self,type)
		self.set_keep_above(True)
		
		self.config=lyricConfig.LyricConfig()
		
		pos_x,pos_y=self.config.get_window_position()
		if pos_x!="None" and pos_y!="None":
			self.move(int(pos_x),int(pos_y))
		
		darea = gtk.DrawingArea()
		self.add(darea)
		darea.show()
		
		layout = self.create_pango_layout("kanglog lyric")
		layout.set_justify(False)
		
		fontdesc=pango.FontDescription(self.config.get_font_desc());
		layout.set_font_description(fontdesc)
		layout.set_data("bgcolor", gtk.gdk.color_parse("#000000"))
		layout.set_data("fgcolor",gtk.gdk.color_parse(self.config.get_font_fgcolor()))
		
		alignment=pango.ALIGN_CENTER
		layout.set_alignment(alignment)
		
		ellipsize=pango.ELLIPSIZE_NONE
		if ellipsize != pango.ELLIPSIZE_NONE:
			layout.set_wrap(pango.WRAP_WORD)
		try:
			layout.set_ellipsize(ellipsize)
		except AttributeError:
			print "ellipsize attribute not supported, ignored"
			
		max_width=None
		if max_width is None:
			MAX_WIDTH = gdk.screen_width() - 8
		else:
			MAX_WIDTH = max_width - 8
		layout.set_width(pango.SCALE*MAX_WIDTH)

		self.drop_shadow=True
		
		self.darea=darea
		self.layout=layout
		self.MAX_WIDTH=MAX_WIDTH

		
		gobject.signal_new("style-set", pango.Layout,
			gobject.SIGNAL_RUN_LAST,
			gobject.TYPE_NONE,
			(gobject.TYPE_PYOBJECT,))
			
		layout.connect("style-set",self.osd)
		layout.set_text("kanglog lyric")
		layout.emit("style-set",None)
Example #44
-1
	def __init__(self):
		self.tempo = 120
		self.channels = []
		self.control_channel = 1
		self.control_channel_cur = 0
		self.device = self.MidiDevice()
		self.global_pattern = []
		gobject.GObject.__init__(self)
		gobject.type_register(self.Channel)
		gobject.signal_new("bar-end", self.Channel, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
		print "Starting Sequencer..."
 def __init__(self):
     print "Inicio"
     
     gobject.type_register(Sender)
     gobject.signal_new("z_signal", Sender, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
                
     sender = Sender()
     receiver = Reciever(sender)
     
     sender.connect('z_signal', self.user_callback)
     sender.emit('z_signal')
 def __init__(self, scheme_file):
     gtk.DrawingArea.__init__(self)
     
     self.connect('size-allocate', self.size_allocate_cb)
     self.scheme_file = scheme_file
     
     self.add_events(gtk.gdk.BUTTON_MOTION_MASK | gtk.gdk.BUTTON_PRESS_MASK |gtk.gdk.BUTTON_RELEASE_MASK)
     self.connect("button-release-event", self.button_release_cb)
     
     gobject.signal_new('block-clicked', MyArea, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,(int,))
     gobject.signal_new('per-row-changed', MyArea, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,(int,))
Example #47
-1
    def __init__(self, db):
        gtk.ListStore.__init__(self, object)
        self.db = db

        proj = self.db.get_projection()
        self.projection = freenav.projection.Lambert(
            proj['parallel1'], proj['parallel2'],
            proj['latitude'], proj['longitude'])

        gobject.signal_new("task_changed", TaskListStore,
                           gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
Example #48
-1
 def __init__(self):
         gobject.GObject.__init__(self)
         self.__emit = False
         self.HOTKEYS = {}
         thread.start_new_thread(self.__catchMsgs, tuple())
         gobject.timeout_add(5,self.checkEmit)
         gobject.signal_new(
                 "HOTKEY-PRESS",
                 self.__class__, gobject.SIGNAL_RUN_LAST,
                         gobject.TYPE_BOOLEAN,
                 (gobject.TYPE_STRING,)
                 )
Example #49
-1
 def __init__(cls,*kwds):
     gobject.GObjectMeta.__init__(cls,*kwds)
     cls.__gtype_name__ = cls.__name__
     gobject.signal_new('time_changed', cls,
                        gobject.SIGNAL_RUN_FIRST,
                        gobject.TYPE_NONE,
                        (gobject.TYPE_PYOBJECT,))
     gobject.signal_new('date_changed', cls,
                        gobject.SIGNAL_RUN_FIRST,
                        gobject.TYPE_NONE,
                        (gobject.TYPE_PYOBJECT,))
     gobject.type_register(cls)
Example #50
-1
    def build_signals(self):
        gobject.signal_new("play", Playlist, gobject.SIGNAL_RUN_LAST, 
                           gobject.TYPE_BOOLEAN, (gobject.TYPE_PYOBJECT,))

        gobject.signal_new("pause", Playlist, gobject.SIGNAL_RUN_LAST, 
                          gobject.TYPE_BOOLEAN, (gobject.TYPE_PYOBJECT,))

        gobject.signal_new("stop", Playlist, gobject.SIGNAL_RUN_LAST, 
                          gobject.TYPE_BOOLEAN, (gobject.TYPE_PYOBJECT,))

        gobject.signal_new("next", Playlist, gobject.SIGNAL_RUN_LAST, 
                          gobject.TYPE_BOOLEAN, (gobject.TYPE_PYOBJECT,))

        gobject.signal_new("prev", Playlist, gobject.SIGNAL_RUN_LAST, 
                          gobject.TYPE_BOOLEAN, (gobject.TYPE_PYOBJECT,))
Example #51
-1
    def setupSignals(self):
        # Definition des signaux
        gobject.signal_new("quitter", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
        gobject.signal_new("waiting-for-this-week", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
        gobject.signal_new("waiting-for-dl-img", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
        gobject.signal_new("waiting-for-params", MainWindow, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ())
        gobject.signal_new("pb-dl", FirstRunWindow, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ())

        # Connection des signaux
        self.connect("destroy", self.doEmit, "quitter")
        self.quitterAction.connect("activate", self.doEmit, "quitter")
        self.parametresAction.connect("activate", self.doEmit, "waiting-for-params")
        self.aboutAction.connect("activate", self.displayAbout)
        self.thisWeek.connect("clicked", self.doEmit, "waiting-for-this-week")
        self.week.connect("changed", self.doEmit, "waiting-for-dl-img")
        self.grp.connect("changed", self.doEmit, "waiting-for-dl-img")
Example #52
-1
    def __init__(self):

        super(GoogleSpeechToTextSink, self).__init__()

        self.last_timestamp = None
        self.sinkpad = gst.Pad(self._sinktemplate)
        self.sinkpad.set_setcaps_function(self._sink_setcaps)
        self.sinkpad.set_chain_function(self._sink_chain)
        self.add_pad(self.sinkpad)
        gobject.signal_new('result', self,
                           gobject.SIGNAL_RUN_LAST,
                           gobject.TYPE_NONE,
                           (gobject.TYPE_PYOBJECT,))
        self.fd = None
        self.timer_event = None
        self.timeout = 0.8   # TODO: Should be a property
	def __init__(self, args=None, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, threaded=True, read=80):
		subprocess.Popen.__init__(self,args=args, bufsize=bufsize, executable=executable, stdin=stdin, stdout=stdout, stderr=stderr, preexec_fn=preexec_fn, close_fds=close_fds, shell=shell, cwd=cwd, env=env, universal_newlines=universal_newlines, startupinfo=startupinfo, creationflags=creationflags)
		
		self.sout = []
		self.lock = threading.Lock()
		
		if not threaded:
			pass
		else:
			try:
				gobject.type_register(self.Sender)
				gobject.signal_new("z_signal", self.Sender, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object,))
			except:
				print "Error registering z_signal"
			
			self.out_pipe, self.err_pipe = self.PipeThread(self, self.stdout, read), self.PipeThread(self, self.stderr)
			self.out_pipe.start(), self.err_pipe.start()
Example #54
-1
    def __init__(self):

        gtk.TextView.__init__(self)

        gobject.signal_new(
            "pause-toggled", ScrolledText, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT,)
        )

        gobject.signal_new(
            "speed-changed", ScrolledText, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_INT,)
        )

        # self.text_buffer = gtk.TextBuffer(None)
        # self.set_buffer(self.text_buffer)

        self.set_editable(False)
        self.set_cursor_visible(False)

        self.vadjustment = gtk.Adjustment()
        self.hadjustment = gtk.Adjustment()

        self.set_scroll_adjustments(self.hadjustment, self.vadjustment)

        self.text_properties = TextProperties()
        self.scroll_properties = ScrollProperties()
        self.scroll_type = ScrollType()

        self.set_properties()

        self.set_property("height_request", 200)
        self.set_property("width_request", 300)

        self.set_wrap_mode(self.text_wrap_mode)
        # self.set_justification(gtk.JUSTIFY_FILL) # don't support yet

        self.connect("key-press-event", self.key_press_event_cb)
        self.connect("key-release-event", self.key_release_event_cb)

        self.connect("scroll-event", self.scroll_event_cb)

        if self.mouse_scroll_type:
            self.button_press_id = self.connect("button_press_event", self.button_press_event_cb)
            self.button_release_id = self.connect("button_release_event", self.button_press_event_cb)
        else:
            self.button_press_id = None
            self.button_release_id = None
Example #55
-1
def test_keybinding_signal_on_gobject():
    """
    Attempt to bind a keybinding to a signal in a non-gtk class.

    Test should fail with a warning message because only gtk classes
    can have keybindings.
    """

    class Test47(gobject.GObject):
        pass

    gobject.type_register(Test47)

    # Add a signal to the class
    gobject.signal_new(
        "asignal", Test47, gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION, gobject.TYPE_NONE, (gobject.TYPE_INT,)
    )
    gtk.binding_entry_add_signal(Test47, gtk.keysyms.x, 0, "asignal", int, 5)
Example #56
-1
    def __init__(self):
        super(Numpad, self).__init__()
        
        self.flag = 0
        self.text = ""
        
        pangoFont = pango.FontDescription("Tahoma 24.2")

        try:
            gobject.signal_new("z_signal", self, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_BOOLEAN, ))
        except:
            pass

        self.set_decorated(False)
        
        self.modify_font(pangoFont)
        
        self.set_title("Set timeout")
        
        self.tb = gtk.TextBuffer()
        self.tb.set_text("Set timeout")
        
        self.set_default_size(MULT*160, MULT*90)

        self.tv = gtk.TextView(self.tb)
        self.tv.modify_font(pangoFont)
        
        self.tv.set_editable(False)
        self.tv.set_border_width(3)

        self.vbox  = gtk.VBox()
        self.vbox.add(self.tv)

        self.hbox = {}
        for i in range(KB_ROWS):
            self.hbox[i] = gtk.HBox()
            for j in range(KB_COLS):
                self.button = gtk.Button(label = buttons_ru[i*KB_COLS+j])
                self.button.connect("clicked", self.on_click, i*KB_COLS+j)
                self.hbox[i].add(self.button)
            self.vbox.add(self.hbox[i])

        self.add(self.vbox)
        self.set_position(gtk.WIN_POS_CENTER)
Example #57
-1
    def __init__(self,delay=1000,max_line=15,width=50,lines=[], foreground="white"):
        ## Initialise gtk.VBox, gtk.HBox
        gtk.VBox.__init__(self)
        self.lines = lines
        self.delay = int(delay)          # Temps en ms entre deux appels de la fonction onTimeout
        self.max_line = int(max_line)    # Nombre de lignes à afficher au maximum
        self.width = int(width)          # Nombre de caractères par lignes
        self.phase = "init"         # si init, affiche des NO rouges, sinon affiche des OK verts
        self.timer = None
        self.cursor = 0
        self.team = ""
        self.updated_team = []
        self.foreground = foreground

        self.text = gtk.Label()
        self.text.set_alignment(0,0)
        self.add(self.text)
        gobject.signal_new("team-update",DecryptBox,gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [gobject.TYPE_STRING,gobject.TYPE_BOOLEAN])
        gobject.signal_new("interne-stop", ScrolledLabelBox, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, [])
Example #58
-1
	def __init__(self, frame, message="", default_text='', textview=None, modal= True):
		gtk.Dialog.__init__(self)
		gobject.signal_new("find-click", gtk.Window, gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_STRING,))
		self.textview = textview
		self.nicotine = frame
		self.connect("destroy", self.quit)
		self.connect("delete-event", self.quit)
		
		self.nextPosition = None	
		self.currentPosition = None
		self.lastdirection = "next"
		if modal:
			self.set_modal(True)
		box = gtk.VBox(spacing=10)
		box.set_border_width(10)
		self.vbox.pack_start(box)
		box.show()
		if message:
			label = gtk.Label(message)
			box.pack_start(label, False, False)
			label.set_line_wrap(True)
			label.show()
		self.entry = gtk.Entry()
	
		box.pack_start(self.entry, False, False)
		self.entry.show()
		self.entry.grab_focus()
		self.entry.connect("activate", self.next)
		Previousbutton = self.nicotine.CreateIconButton(gtk.STOCK_GO_BACK, "stock", self.previous, _("Previous"))
		Previousbutton.set_flags(gtk.CAN_DEFAULT)
		self.action_area.pack_start(Previousbutton)

		Nextbutton = self.nicotine.CreateIconButton(gtk.STOCK_GO_FORWARD, "stock", self.next, _("Next"))
		Nextbutton.set_flags(gtk.CAN_DEFAULT)
		self.action_area.pack_start(Nextbutton)
		Nextbutton.grab_default()
		
		
		Cancelbutton = self.nicotine.CreateIconButton(gtk.STOCK_CANCEL, "stock", self.quit, _("Cancel"))
		Cancelbutton.set_flags(gtk.CAN_DEFAULT)
		self.action_area.pack_start(Cancelbutton)
Example #59
-1
    def _add_tooltip_support(self):
        # Add the "tool tips"
        popup_win = gtk.Window(gtk.WINDOW_POPUP)
        label = gtk.Label()
        popup_win.add(label)

        if "path-cross-event" not in gobject.signal_list_names(gtk.TreeView):
            gobject.signal_new("path-cross-event", gtk.TreeView,
                               gobject.SIGNAL_RUN_LAST,
                               gobject.TYPE_BOOLEAN, (gtk.gdk.Event,))

            gobject.signal_new("column-cross-event", gtk.TreeView,
                               gobject.SIGNAL_RUN_LAST,
                               gobject.TYPE_BOOLEAN, (gtk.gdk.Event,))

            gobject.signal_new("cell-cross-event", gtk.TreeView,
                               gobject.SIGNAL_RUN_LAST,
                               gobject.TYPE_BOOLEAN, (gtk.gdk.Event,))

        self.connect(
            "leave-notify-event", self.on_treeview_leave_notify, popup_win)
        self.connect("motion-notify-event", self.on_treeview_motion_notify)

        self.connect("path-cross-event", self.emit_cell_cross_signal)
        self.connect("column-cross-event", self.emit_cell_cross_signal)

        self.connect("cell-cross-event", self.handle_popup, popup_win)

        # Handle double click on a row
        self.connect("row-activated", self.handle_double_click)