Python gi.repository.GLib.threads_init() Examples
The following are 7
code examples of gi.repository.GLib.threads_init().
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.GLib
, or try the search function
.
Example #1
Source File: prayertime.py From Silaty with GNU General Public License v3.0 | 7 votes |
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
Example #2
Source File: gireactor.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 6 votes |
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)
Example #3
Source File: dbus_ctrl.py From simLAB with GNU General Public License v2.0 | 6 votes |
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
Example #4
Source File: gireactor.py From learn_python3_spider with MIT License | 6 votes |
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)
Example #5
Source File: utils.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
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()
Example #6
Source File: silaty.py From Silaty with GNU General Public License v3.0 | 5 votes |
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")
Example #7
Source File: gtkapp.py From autokey with GNU General Public License v3.0 | 4 votes |
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)