Beispiel #1
0
 def PopupMenu( self, window: QW.QWidget, menu: QW.QMenu ):
     
     if HC.PLATFORM_MACOS and window.window().isModal():
         
         # Ok, seems like Big Sur can't do menus at the moment lmao. it shows the menu but the mouse can't interact with it
         
         from hydrus.core import HydrusGlobals as HG
         
         if HG.client_controller.new_options.GetBoolean( 'do_macos_debug_dialog_menus' ):
             
             from hydrus.client.gui import ClientGUICoreMenuDebug
             
             ClientGUICoreMenuDebug.ShowMenuDialog( window, menu )
             
             ClientGUIMenus.DestroyMenu( menu )
             
             return
             
         
     
     if not menu.isEmpty():
         
         self._menu_open = True
         
         menu.exec_( QG.QCursor.pos() ) # This could also be window.mapToGlobal( QC.QPoint( 0, 0 ) ), but in practice, popping up at the current cursor position feels better.
         
         self._menu_open = False
         
     
     ClientGUIMenus.DestroyMenu( menu )
Beispiel #2
0
 def PopupMenu( self, window, menu ):
     
     if not menu.isEmpty():
         
         self._menu_open = True
         
         menu.exec_( QG.QCursor.pos() ) # This could also be window.mapToGlobal( QC.QPoint( 0, 0 ) ), but in practice, popping up at the current cursor position feels better.
         
         self._menu_open = False
         
     
     ClientGUIMenus.DestroyMenu( menu )
    def _RegenerateMenu(self):

        # I'm not a qwidget, but a qobject, so use my parent for this
        parent_widget = self.parent()

        new_menu = QW.QMenu(parent_widget)

        self._show_hide_menu_item = ClientGUIMenus.AppendMenuItem(
            new_menu, 'show/hide', 'Hide or show the hydrus client',
            self.flip_show_ui.emit)

        self._UpdateShowHideMenuItemLabel()

        ClientGUIMenus.AppendSeparator(new_menu)

        self._network_traffic_menu_item = ClientGUIMenus.AppendMenuItem(
            new_menu, 'network traffic', 'Pause/resume network traffic',
            self.flip_pause_network_jobs.emit)

        self._UpdateNetworkTrafficMenuItemLabel()

        self._subscriptions_paused_menu_item = ClientGUIMenus.AppendMenuItem(
            new_menu, 'subscriptions', 'Pause/resume subscriptions',
            self.flip_pause_subscription_jobs.emit)

        self._UpdateSubscriptionsMenuItemLabel()

        ClientGUIMenus.AppendSeparator(new_menu)

        ClientGUIMenus.AppendMenuItem(new_menu, 'exit',
                                      'Close the hydrus client',
                                      self.exit_client.emit)

        #

        old_menu = self.contextMenu()

        self.setContextMenu(new_menu)

        if old_menu is not None:

            ClientGUIMenus.DestroyMenu(old_menu)

        self._UpdateTooltip()