本文整理汇总了Python中gi.repository.GObject.GObject方法的典型用法代码示例。如果您正苦于以下问题:Python GObject.GObject方法的具体用法?Python GObject.GObject怎么用?Python GObject.GObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GObject
的用法示例。
在下文中一共展示了GObject.GObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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")
示例2: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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()
示例3: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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()
示例4: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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)
示例5: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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")
示例6: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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")
示例7: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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
示例8: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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
示例9: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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
示例10: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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 = {}
示例11: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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
示例12: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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)
示例13: _get_markup_for_value
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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)
示例14: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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()
示例15: __init__
# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import GObject [as 别名]
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()