当前位置: 首页>>代码示例>>Python>>正文


Python GLib.threads_init方法代码示例

本文整理汇总了Python中gi.repository.GLib.threads_init方法的典型用法代码示例。如果您正苦于以下问题:Python GLib.threads_init方法的具体用法?Python GLib.threads_init怎么用?Python GLib.threads_init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.GLib的用法示例。


在下文中一共展示了GLib.threads_init方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import threads_init [as 别名]
def __init__(self):
        GLib.threads_init()
        Gst.init(None)

        self.options = Options()

        year  = datetime.datetime.now().year
        month = datetime.datetime.now().month
        day   = datetime.datetime.now().day
        self.date = date(year, month, day)

        self._shrouk = None
        self._fajr = None
        self._zuhr = None
        self._asr = None
        self._maghrib = None
        self._isha = None
        self._nextprayer = ""
        self._tnprayer = 0
        self.dec = 0 
开发者ID:Jessewb786,项目名称:Silaty,代码行数:22,代码来源:prayertime.py

示例2: _oldGiInit

# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import threads_init [as 别名]
def _oldGiInit():
    """
    Make sure pygtk and gi aren't loaded at the same time, and import Glib if
    possible.
    """
    # We can't immediately prevent imports, because that confuses some buggy
    # code in gi:
    _glibbase.ensureNotImported(
        _PYGTK_MODULES,
        "Introspected and static glib/gtk bindings must not be mixed; can't "
        "import gireactor since pygtk2 module is already imported.")

    global GLib
    from gi.repository import GLib
    if getattr(GLib, "threads_init", None) is not None:
        GLib.threads_init()

    _glibbase.ensureNotImported([], "",
                                preventImports=_PYGTK_MODULES) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:21,代码来源:gireactor.py

示例3: run_gui_thread

# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import threads_init [as 别名]
def run_gui_thread(gui_config=None, runtime_config=None):
    from gi.repository import GLib
    from gi.repository import Gdk
    from rafcon.core.start import reactor_required
    from rafcon.gui.start import start_gtk, install_reactor
    from rafcon.utils.i18n import setup_l10n
    global gui_ready
    # see https://stackoverflow.com/questions/35700140/pygtk-run-gtk-main-loop-in-a-seperate-thread
    # not needed any more:
    # https://pygobject.readthedocs.io/en/latest/guide/threading.html?highlight=threads_init#threads-faq
    # GLib.threads_init()
    if reactor_required():
        install_reactor()
    setup_l10n()
    from rafcon.gui.controllers.main_window import MainWindowController
    from rafcon.gui.views.main_window import MainWindowView

    initialize_environment_gui(gui_config, runtime_config)
    main_window_view = MainWindowView()
    main_window_view.get_top_widget().set_gravity(Gdk.Gravity.STATIC)
    MainWindowController(rafcon.gui.singleton.state_machine_manager_model, main_window_view)

    print("run_gui thread: ", currentThread(), currentThread().ident, "gui.singleton thread ident:", \
        rafcon.gui.singleton.thread_identifier)

    # Wait for GUI to initialize
    wait_for_gui()
    # Set an event when the gtk loop is running
    GLib.idle_add(gui_ready.set)
    start_gtk() 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:32,代码来源:utils.py

示例4: run

# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import threads_init [as 别名]
def run(self):
        logging.info('D-Bus process started')
        GLib.threads_init()  # allow threads in GLib
        GLib.idle_add(self._idleQueueSync)

        DBusGMainLoop(set_as_default=True)
        dbusService = SessionDBus(self.taskQueue, self.resultQueue)

        try:
            GLib.MainLoop().run()
        except KeyboardInterrupt:
            logging.debug("\nThe MainLoop will close...")
            GLib.MainLoop().quit()
        return 
开发者ID:kamwar,项目名称:simLAB,代码行数:16,代码来源:dbus_ctrl.py

示例5: __init__

# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import threads_init [as 别名]
def __init__(self):
        GLib.threads_init()
        Gdk.threads_init()

        p = optparse.OptionParser()
        p.add_option("-l", "--verbose", help="Enable verbose logging", action="store_true", default=False)
        p.add_option("-c", "--configure", help="Show the configuration window on startup", action="store_true", default=False)
        options, args = p.parse_args()

        try:
            # Create configuration directory
            if not os.path.exists(common.CONFIG_DIR):
                os.makedirs(common.CONFIG_DIR)
            # Create data directory (for log file)
            if not os.path.exists(common.DATA_DIR):
                os.makedirs(common.DATA_DIR)
            # Create run directory (for lock file)
            if not os.path.exists(common.RUN_DIR):
                os.makedirs(common.RUN_DIR)

            # Initialise logger
            rootLogger = logging.getLogger()

            if options.verbose:
                rootLogger.setLevel(logging.DEBUG)
                handler = logging.StreamHandler(sys.stdout)
            else:
                rootLogger.setLevel(logging.INFO)
                handler = logging.handlers.RotatingFileHandler(common.LOG_FILE,
                                        maxBytes=common.MAX_LOG_SIZE, backupCount=common.MAX_LOG_COUNT)

            handler.setFormatter(logging.Formatter(common.LOG_FORMAT))
            rootLogger.addHandler(handler)

            if self.__verifyNotRunning():
                self.__createLockFile()

            self.initialise(options.configure)

        except Exception as e:
            self.show_error_dialog(_("Fatal error starting AutoKey.\n") + str(e))
            logging.exception("Fatal error starting AutoKey: " + str(e))
            sys.exit(1) 
开发者ID:autokey,项目名称:autokey,代码行数:45,代码来源:gtkapp.py

示例6: __init__

# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import threads_init [as 别名]
def __init__(self, parent):
        Gtk.Window.__init__(self)
        GLib.threads_init()
        Gst.init(None)

        # Set parent widget
        self.parent = parent
        self.lock_location_updates = False

        # Init dialog
        self.dialog = None

        # Tweak window
        self.set_decorated(True)
        self.set_icon_name('silaty')
        self.set_modal(True)
        self.set_resizable(False)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.connect('delete-event', self.hide_window)
        #self.set_default_size(429, 440)
        self.headerbar = Gtk.HeaderBar()

        # Set up mainbox
        self.mainbox = Gtk.Box()
        self.mainbox.set_orientation(Gtk.Orientation.HORIZONTAL)

        self.prayertimes = Prayertime()
        self.prayertimes.calculate()
        #self.prayertimes.notify('Title', 'This is a test.')

        # Set language
        set_language(self.prayertimes.options.language)
        if self.prayertimes.options.language == 'Arabic':
            #self.set_gravity(Gdk.Gravity.NORTH_EAST)
            #self.set_direction(Gtk.TextDirection.RTL)
            Gtk.Widget.set_default_direction(Gtk.TextDirection.RTL)

        # Set layout
        self.set_layout()

        if self.prayertimes.options.start_minimized == False:
            self.show_all()
            self.sidebar.emit("window-shown") 
开发者ID:Jessewb786,项目名称:Silaty,代码行数:45,代码来源:silaty.py


注:本文中的gi.repository.GLib.threads_init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。