Changeset 1108:0d45f3dff91b


Ignore:
Timestamp:
09/21/23 10:32:56 (14 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

On Linux the CEF message loop is run

Location:
src/mlx/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/cef.py

    r1099 r1108  
    215215def _initializeCEF(args, initializedCallback):
    216216    """Perform the actual initialization of CEF using the given arguments."""
    217     if os.name=="nt":
    218         _initializeCEF1(args, initializedCallback)
    219     else:
    220         GObject.timeout_add(100, _initializeCEF1, args, initializedCallback)
    221 
    222 #------------------------------------------------------------------------------
    223 
    224 def _initializeCEF1(args, initializedCallback):
    225     """Perform the actual initialization of CEF using the given arguments."""
    226217    print("Initializing CEF with args:", args)
    227218
     
    261252    initializedCallback()
    262253    return False
     254
     255#------------------------------------------------------------------------------
     256
     257def messageLoop():
     258    """Run the CEF message loop"""
     259    cefpython.MessageLoop()
    263260
    264261#------------------------------------------------------------------------------
     
    383380#------------------------------------------------------------------------------
    384381
     382def quitMessageLoop():
     383    """Quit the CEF message loop"""
     384    cefpython.QuitMessageLoop()
     385
     386#------------------------------------------------------------------------------
     387
    385388def finalize():
    386389    """Finalize the Chrome Embedded Framework."""
  • src/mlx/gui/gui.py

    r1106 r1108  
    485485
    486486        singleton.raiseCallback = self.raiseCallback
    487         Gtk.main()
     487        if os.name=="nt":
     488            Gtk.main()
     489        else:
     490            cef.initialize(self._cefInitialized)
     491            cef.messageLoop()
     492
    488493        singleton.raiseCallback = None
    489494
     
    13231328        if result==Gtk.ResponseType.YES:
    13241329            self._statusIcon.destroy()
    1325             return Gtk.main_quit()
     1330            if os.name=="nt":
     1331                return Gtk.main_quit()
     1332            else:
     1333                cef.quitMessageLoop()
     1334                return True
    13261335
    13271336    def _notebookPageSwitch(self, notebook, page, page_num):
     
    19721981        It checks if we already know the PID, and if not, asks the user whether
    19731982        to register."""
    1974         cef.initialize(self._cefInitialized)
     1983        if os.name=="nt":
     1984            cef.initialize(self._cefInitialized)
    19751985
    19761986        if not self.config.pilotID and not self.config.password:
Note: See TracChangeset for help on using the changeset viewer.