Python gi.repository.GObject.GObject() Examples
The following are 30
code examples of gi.repository.GObject.GObject().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.GObject
, or try the search function
.
Example #1
Source File: player.py From Audio-Cutter with GNU General Public License v3.0 | 6 votes |
def __init__(self): GObject.GObject.__init__(self) GstPbutils.pb_utils_init() self._discoverer = GstPbutils.Discoverer.new(10 * Gst.SECOND) self.is_playing = False self.filepath = None self._duration = Gst.CLOCK_TIME_NONE self.asset = None self._playbin = Gst.ElementFactory.make("playbin", "player") bus = self._playbin.get_bus() bus.add_signal_watch() bus.connect("message::error", self.__on_bus_error) bus.connect("message::eos", self.__on_bus_eos) bus.connect("message::element", self.__on_bus_element) bus.connect("message::stream-start", self._on_stream_start)
Example #2
Source File: add.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def __init__(self, **kwargs): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) GObject.GObject.__init__(self) self.is_edit = kwargs.get("edit", False) self._account = kwargs.get("account", None) self._providers_store = Gtk.ListStore(str, str) self.logo_img = Gtk.Image() self.username_entry = Gtk.Entry() self.provider_combo = Gtk.ComboBox.new_with_model_and_entry( self._providers_store) self.token_entry = Gtk.Entry() self._build_widgets() self._fill_data()
Example #3
Source File: account.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def __init__(self, _id, username, provider, secret_id): GObject.GObject.__init__(self) self.id = _id self.username = username self.provider = provider self.secret_id = secret_id token = Keyring.get_by_id(self.secret_id) self.connect("otp_out_of_date", self._on_otp_out_of_date) if token: self.otp = OTP(token) self._code_generated = True else: self.otp = None self._code_generated = False Logger.error("Could not read the secret code," "the keyring keys were reset manually")
Example #4
Source File: widgets.py From nautilus-folder-icons with GNU General Public License v3.0 | 6 votes |
def __init__(self, folders): GObject.GObject.__init__(self) Thread.__init__(self) Gtk.Window.__init__(self) self.connect("delete-event", self._close_window) # Here i assume that all folders got the same icon... self._folders = folders self.model = [] self._flowbox = Gtk.FlowBox() # Threading stuff self.setDaemon(True) self.run() # Window configurations self.set_default_size(650, 500) self.set_size_request(650, 500) self.set_resizable(True) self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT) self.connect("key-press-event", self._on_key_press) # Widgets & Accelerators self._build_header_bar() self._build_content() self._setup_accels()
Example #5
Source File: __init__.py From pychess with GNU General Public License v3.0 | 6 votes |
def __init__(self): GObject.GObject.__init__(self) Perspective.__init__(self, "database", _("Database")) self.widgets = gamewidget.getWidgets() self.first_run = True self.chessfile = None self.chessfiles = [] self.importer = None self.gamelists = [] self.filter_panels = [] self.opening_tree_panels = [] self.preview_panels = [] self.notebooks = {} self.page_dict = {} self.connect("chessfile_opened0", self.on_chessfile_opened0) self.dockLocation = addUserConfigPrefix("pydock-database.xml")
Example #6
Source File: __init__.py From pychess with GNU General Public License v3.0 | 6 votes |
def __init__(self): GObject.GObject.__init__(self) Perspective.__init__(self, "games", _("Games")) self.notebooks = {} self.first_run = True self.gamewidgets = set() self.gmwidg_cids = {} self.board_cids = {} self.notify_cids = defaultdict(list) self.key2gmwidg = {} self.key2cid = {} self.dock = None self.dockAlign = None self.dockLocation = addUserConfigPrefix("pydock.xml")
Example #7
Source File: ping.py From pychess with GNU General Public License v3.0 | 6 votes |
def __init__(self, host): GObject.GObject.__init__(self) self.host = host self.subproc = None self.expression = re.compile(r"=([\d\.]+) (m?s)") # We need untranslated error messages in regexp search # below, so have to use deferred translation here def _(msg): return msg error = _("Destination Host Unreachable") self.errorExprs = (re.compile("(%s)" % error), ) del _ self.restartsOnDead = 3 self.deadCount = 0
Example #8
Source File: SubProcess.py From pychess with GNU General Public License v3.0 | 6 votes |
def __init__(self, path, args=[], warnwords=[], env=None, cwd=".", lowPriority=False): GObject.GObject.__init__(self) self.path = path self.args = args self.warnwords = warnwords self.env = env or os.environ self.cwd = cwd self.lowPriority = lowPriority self.defname = os.path.split(path)[1] self.defname = self.defname[:1].upper() + self.defname[1:].lower() cur_time = time.time() self.defname = (self.defname, time.strftime("%H:%m:%%.3f", time.localtime(cur_time)) % (cur_time % 60)) log.debug(path + " " + " ".join(self.args), extra={"task": self.defname}) self.argv = [str(u) for u in [self.path] + self.args] self.terminated = False
Example #9
Source File: FICSObjects.py From pychess with GNU General Public License v3.0 | 6 votes |
def __init__(self, name, online=False, status=IC_STATUS_UNKNOWN, game=None, titles=None): assert isinstance(name, str), name assert isinstance(online, bool), online GObject.GObject.__init__(self) self.player_id = player_id(name) self.name = name self.online = online self._status = status self.status = status self.game = None self.adjournment = False self.ratings = [0 for ratingtype in RATING_TYPES] self.deviations = [DEVIATION_NONE for ratingtype in RATING_TYPES] if titles is None: self.titles = set() else: self.titles = titles
Example #10
Source File: FICSConnection.py From pychess with GNU General Public License v3.0 | 6 votes |
def __init__(self, host, ports, timeseal, username, password): GObject.GObject.__init__(self) self.daemon = True self.host = host self.ports = ports self.username = username self.password = password self.timeseal = timeseal self.connected = False self.connecting = False self.keep_alive_task = None self.predictions = set() self.predictionsDict = {} self.reply_cmd_dict = defaultdict(list) # Are we connected to FatICS ? self.FatICS = False self.USCN = False self.ICC = False self.replay_dg_dict = {} self.replay_cn_dict = {}
Example #11
Source File: stdownloader.py From syncthing-gtk with GNU General Public License v2.0 | 6 votes |
def __init__(self, target, platform): """ Target - ~/.local/bin/syncthing or similar target location for daemon binary Platform - linux-386, windows-adm64 or other suffix used on syncthing releases page. """ GObject.GObject.__init__(self) self.target = target self.platform = platform # Latest Syncthing version known to be compatible with # Syncthing-GTK. This is just hardcoded minimal version, # actual value will be determined later self.latest_compat = "v0.11.0" self.forced = None self.version = None self.dll_url = None self.dll_size = None
Example #12
Source File: results.py From runsqlrun with MIT License | 6 votes |
def __init__(self, data, selection): self.data = data self.result_selection = selection self._num_rows = len(self.data) if self.data: self._n_columns = len(self.data[0]) else: self._n_columns = 0 lbl = Gtk.Label() context = lbl.get_style_context() col = context.get_color(Gtk.StateFlags.INSENSITIVE) self._col_insensitive_str = col.to_color().to_string() self._col_bg_selected = context.get_background_color( Gtk.StateFlags.SELECTED) self._col_bg_normal = context.get_background_color( Gtk.StateFlags.NORMAL) GObject.GObject.__init__(self)
Example #13
Source File: results.py From runsqlrun with MIT License | 6 votes |
def _get_markup_for_value(self, value, markup=True): if value is None: return self._markup_none(value, markup) elif self.is_blob_value(value): return self._markup_blob(value) else: data = str(value) lines = data.splitlines() if len(lines) > 1: return '{} <span color="{}">[...]</span>'.format( GObject.markup_escape_text(lines[0]), self._col_insensitive_str) elif lines: return GObject.markup_escape_text(lines[0]) else: return GObject.markup_escape_text(data)
Example #14
Source File: accounts_manager.py From Authenticator with GNU General Public License v2.0 | 5 votes |
def __init__(self): GObject.GObject.__init__(self) Thread.__init__(self) self._accounts = [] self._alive = True self.__fill_accounts() self.counter_max = 30 self.counter = self.counter_max self.start()
Example #15
Source File: docsearch.py From paperwork-backend with GNU General Public License v3.0 | 5 votes |
def __init__(self, docsearch): GObject.GObject.__init__(self) self.docsearch = docsearch
Example #16
Source File: pomodoro_indicator.py From pomodoro-indicator with GNU General Public License v3.0 | 5 votes |
def emit(self, *args): GLib.idle_add(GObject.GObject.emit, self, *args)
Example #17
Source File: pomodoro_indicator.py From pomodoro-indicator with GNU General Public License v3.0 | 5 votes |
def __init__(self): GObject.GObject.__init__(self) self.pw = 0 # self.player = Gst.ElementFactory.make("playbin", "player") # self.player.connect("about-to-finish", self.on_player_finished) # bus = self.player.get_bus() # bus.connect("message", self.on_player_message) self.icon = comun.ICON self.active_icon = None self.about_dialog = None self.active = False self.animate = False self.frame = 0 self.pomodoros = 0 self.player = Player() self.notification = Notify.Notification.new('', '', None) self.read_preferences() # self.indicator = appindicator.Indicator.new('Pomodoro-Indicator', self.active_icon, appindicator. IndicatorCategory. HARDWARE) self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE) self.indicator.connect('scroll-event', self.on_scroll) menu = self.get_menu() self.indicator.set_menu(menu) self.connect('session_end', self.on_session_end) self.connect('break_end', self.on_break_end)
Example #18
Source File: extensions.py From badKarma with GNU General Public License v3.0 | 5 votes |
def __init__(self): GObject.GObject.__init__(self)
Example #19
Source File: daemon.py From syncthing-gtk with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, command, callback, error_callback=None, *callback_data): Gio.SocketClient.__init__(self, tls=parent._tls) self._callback = callback self._error_callback = error_callback self._command = command self._parent = parent self._connection = None self._callback_data = callback_data or () if parent._tls: GObject.Object.connect(self, "event", self._socket_event)
Example #20
Source File: daemon.py From syncthing-gtk with GNU General Public License v2.0 | 5 votes |
def __init__(self, syncthing_configxml=None): GObject.GObject.__init__(self) TimerManager.__init__(self) self._CSRFtoken = None self._address = None self._api_key = None self._connected = False self._refresh_interval = 1 # seconds self._configxml = syncthing_configxml # syncing_folders holds set of folders that are being synchronized self._syncing_folders = set() # stopped_folders holds set of folders in 'stopped' state # No 'folder-sync', 'folder-sync-progress' and 'folder-scan-started' # events are emitted after folder enters this state self._stopped_folders = set() # syncing_devices does same thing, only for devices self._syncing_devices = set() # and once again, for folders in 'Scanning' state self._scanning_folders = set() # device_data stores data needed to compute transfer speeds # and synchronization state self._device_data = {} # folder_devices stores list of devices assigned to folder self._folder_devices = {} # last_seen holds last_seen value for each folder, preventing firing # last-seen-changed event with same values twice self._last_seen = {} # last_error_time is used to discard repeating errors self._last_error_time = None # Time is taken for first event # last_id is id of last event received from daemon self._last_id = 0 # Epoch is increased when reconnect() method is called; It is # used to discard responses for old REST requests self._epoch = 1 self._instance_id = None self._my_id = None self._read_config() ### Internal stuff ###
Example #21
Source File: editordialog.py From syncthing-gtk with GNU General Public License v2.0 | 5 votes |
def __init__(self, app, gladefile, title): GObject.GObject.__init__(self) self.app = app self.config = None self._loading = False self.values = None self.checks = {} # Stores original label value while error message is displayed. self.original_labels={} # Used by get_widget_id self.widget_to_id = {} self.setup_widgets(gladefile, title) # Move entire dialog content to ScrolledWindow if screen height # is too small if Gdk.Screen.get_default().height() < 900: if not self["editor-content"] is None: parent = self["editor-content"].get_parent() if isinstance(parent, Gtk.Notebook): order, labels = [], {} for c in [] + parent.get_children(): labels[c] = parent.get_tab_label(c) order.append(c) parent.remove(c) for c in order: sw = Gtk.ScrolledWindow() sw.add_with_viewport(c) parent.append_page(sw, labels[c]) else: sw = Gtk.ScrolledWindow() parent.remove(self["editor-content"]) sw.add_with_viewport(self["editor-content"]) parent.pack_start(sw, True, True, 0) self["editor"].resize(self["editor"].get_size()[0], Gdk.Screen.get_default().height() * 2 / 3)
Example #22
Source File: daemonprocess.py From syncthing-gtk with GNU General Public License v2.0 | 5 votes |
def __init__(self, cmdline, priority=PRIORITY_NORMAL, max_cpus=0, env={}): """ cmdline should be list of arguments """ GObject.GObject.__init__(self) self.cmdline = cmdline self.priority = priority self.env = { x:env[x] for x in env } self.env["STNORESTART"] = "1" # see syncthing --help self.env["STNOUPGRADE"] = "1" if max_cpus > 0: self.env["GOMAXPROCS"] = str(max_cpus) self._proc = None
Example #23
Source File: analysis.py From pychess with GNU General Public License v3.0 | 5 votes |
def __init__(self): GObject.GObject.__init__(self) self.defname = 'Dummy' self.Q = Queue()
Example #24
Source File: list.py From Authenticator with GNU General Public License v2.0 | 5 votes |
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) GObject.GObject.__init__(self) self.get_style_context().add_class("accounts-widget") self._providers = {} self._to_delete = [] self._build_widgets() self.__fill_data()
Example #25
Source File: FingerManager.py From pychess with GNU General Public License v3.0 | 5 votes |
def __init__(self, connection): GObject.GObject.__init__(self) self.connection = connection fingerLines = ( r"(?P<never>%s has never connected\.)" % names, "Last disconnected: (?P<last>.+)", "On for: (?P<uptime>.+?) +Idle: (?P<idletime>.+)", r"%s is in (?P<silence>silence) mode\." % names, r"\(playing game (?P<gameno>\d+): (?P<p1>\S+?)%s vs. (?P<p2>\S+?)%s\)" % (titles, titles), r"\(%s (?P<busymessage>.+?)\)" % names, r"%s has not played any rated games\." % names, "rating +RD +win +loss +draw +total +best", "(?P<gametype>%s) +(?P<ratings>.+)" % types, "Email *: (?P<email>.+)", "Sanctions *: (?P<sanctions>.+)", "Total time online: (?P<tto>.+)", r"% of life online: [\d\.]+ \(since (?P<created>.+?)\)", r"Timeseal [ \d] : (?P<timeseal>Off|On)", "Admin Level: (?P<adminlevel>.+)", r"(?P<noteno>\d+): *(?P<note>.*)", "$") self.connection.expect_fromplus(self.onFinger, "Finger of %s:" % names, "$|".join(fingerLines)) self.connection.client.run_command("iset nowrap 1") # We don't use this. Rather we use BoardManagers "gameEnded", after # which we do a refinger. This is to ensure not only rating, but also # wins/looses/draws are updated # self.connection.expect(self.onRatingAdjust, # "%s rating adjustment: (\d+) --> (\d+)" % types # Notice if you uncomment this: The expression has to be compiled with # re.IGNORECASE, or the first letter of 'type' must be capital
Example #26
Source File: AutoLogOutManager.py From pychess with GNU General Public License v3.0 | 5 votes |
def __init__(self, connection): GObject.GObject.__init__(self) self.connection = connection self.connection.expect_line( self.onLogOut, r"\*\*\*\* Auto-logout because you were idle more than \d+ minutes\. \*\*\*\*") self.connection.expect_line(self.onLogOut, r"Logging you out\.") self.connection.expect_line( self.onLogOut, r"\*\*\*\* .+? has arrived - you can't both be logged in\. \*\*\*\*")
Example #27
Source File: SeekManager.py From pychess with GNU General Public License v3.0 | 5 votes |
def __init__(self, connection): GObject.GObject.__init__(self) self.connection = connection self.connection.expect_line(self.on_seek_clear, "<sc>") self.connection.expect_line(self.on_seek_add, "<s(?:n?)> (.+)") self.connection.expect_line(self.on_seek_remove, r"<sr> ([\d ]+)") self.connection.expect_n_lines(self.on_our_seeks_removed, r"<sr> ([\d ]+)", r"Your seeks have been removed\.") self.connection.expect_n_lines(self.on_seek_updated, r"Updating seek ad (\d+)(?:;?) (.*)\.", "", r"<sr> (\d+)", "", "<sn> (.+)") self.connection.expect_n_lines(self.on_seek_updated, r"Updating seek ad (\d+)(?:;?) (.*)\.", r"Updating seek ad \d+(?:;?) (.*)\.", "", r"<sr> (\d+)", "", "<sn> (.+)") self.connection.expect_n_lines( self.on_assess, r"\s*%s\s*" % type_re, r"\s*(\w+)\s+(\w+)\s*", r"\s*(\(.+\))\s+(\(.+\))\s*", r"\s*Win: .+", r"\s*Draw: .+", r"\s*Loss: .+", r"\s*New RD: .+") self.connection.client.run_command("iset seekinfo 1") self.connection.client.run_command("iset seekremove 1") self.connection.client.run_command("iset showownseek 1")
Example #28
Source File: ConsoleManager.py From pychess with GNU General Public License v3.0 | 5 votes |
def __init__(self, connection): GObject.GObject.__init__(self) self.connection = connection self.connection.client.lines.consolehandler = ConsoleHandler( self.onConsoleMessage)
Example #29
Source File: player.py From lplayer with MIT License | 5 votes |
def emit(self, *args): GLib.idle_add(GObject.GObject.emit, self, *args)
Example #30
Source File: pomodoro_indicator.py From pomodoro-indicator with GNU General Public License v3.0 | 5 votes |
def main(): if dbus.SessionBus().request_name( 'es.atareao.PomodoroIndicator') !=\ dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER: print("application already running") exit(0) GObject.threads_init() Gst.init(None) Gst.init_check(None) Notify.init('pomodoro-indicator') Pomodoro_Indicator() Gtk.main()