How to use the hydrus.client.gui.QtPorting function in hydrus

To help you get started, we’ve selected a few hydrus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIAPI.py View on Github external
ClientGUIScrolledPanels.EditPanel.__init__( self, parent )
        
        self._original_api_permissions = api_permissions
        
        self._access_key = QW.QLineEdit()
        
        self._access_key.setReadOnly( True )
        
        width = ClientGUIFunctions.ConvertTextToPixelWidth( self._access_key, 66 )
        
        self.setMinimumWidth( width )
        
        self._name = QW.QLineEdit( self )
        
        self._basic_permissions = QP.CheckListBox( self )
        
        for permission in ClientAPI.ALLOWED_PERMISSIONS:
            
            self._basic_permissions.Append( ClientAPI.basic_permission_to_str_lookup[ permission ], permission )
            
        
        search_tag_filter = api_permissions.GetSearchTagFilter()
        
        message = 'The API will only permit searching for tags that pass through this filter.'
        message += os.linesep * 2
        message += 'If you want to allow all tags, just leave it as is, permitting everything. If you want to limit it to just one tag, such as "do waifu2x on this", set up a whitelist with only that tag allowed.'
        
        self._search_tag_filter = ClientGUITags.TagFilterButton( self, message, search_tag_filter, label_prefix = 'permitted tags: ' )
        
        #
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIAsync.py View on Github external
def QtDoIt( self ):
        
        if self._win is None or not QP.isValid( self._win ):
            
            self._win = None
            
            return
            
        
        with self._lock:
            
            self._callafter_waiting = False
            self._work_needs_to_restart = False
            self._is_working = True
            
            args = self._args
            kwargs = self._kwargs
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIDialogsManage.py View on Github external
self._mappings_list_ctrl = ClientGUIListCtrl.BetterListCtrl( listctrl_panel, CGLC.COLUMN_LIST_MANAGE_UPNP_MAPPINGS.ID, 12, self._ConvertDataToListCtrlTuples, delete_key_callback = self._Remove, activation_callback = self._Edit )
        
        listctrl_panel.SetListCtrl( self._mappings_list_ctrl )
        
        listctrl_panel.AddButton( 'add custom mapping', self._Add )
        listctrl_panel.AddButton( 'edit mapping', self._Edit, enabled_only_on_selection = True )
        listctrl_panel.AddButton( 'remove mapping', self._Remove, enabled_only_on_selection = True )
        
        self._ok = QW.QPushButton( 'ok', self )
        self._ok.clicked.connect( self.EventOK )
        self._ok.setObjectName( 'HydrusAccept' )
        
        #
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, self._status_st, CC.FLAGS_EXPAND_PERPENDICULAR )
        QP.AddToLayout( vbox, listctrl_panel, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( vbox, self._ok, CC.FLAGS_LONE_BUTTON )
        
        self.setLayout( vbox )
        
        size_hint = self.sizeHint()
        
        size_hint.setWidth( max( size_hint.width(), 760 ) )
        
        QP.SetInitialSize( self, size_hint )
        
        #
        
        self._mappings = []
github hydrusnetwork / hydrus / hydrus / client / ClientFiles.py View on Github external
def qt_add_url( url ):
                    
                    if QP.isValid( HG.client_controller.gui ):
                        
                        HG.client_controller.gui.ImportURL( url, 'missing files redownloader' )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIStringControls.py View on Github external
listctrl_panel.SetListCtrl( self._listctrl )
        
        listctrl_panel.AddButton( 'add', self._Add )
        listctrl_panel.AddButton( 'edit', self._Edit, enabled_only_on_selection = True )
        listctrl_panel.AddDeleteButton()
        
        #
        
        self._listctrl.AddDatas( list(initial_dict.items()) )
        
        self._listctrl.Sort()
        
        #
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, listctrl_panel, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        self.setLayout( vbox )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIACDropdown.py View on Github external
self._last_attempted_dropdown_width = 0
        self._last_attempted_dropdown_position = ( None, None )
        
        self._text_ctrl_widget_event_filter = QP.WidgetEventFilter( self._text_ctrl )
        
        self._text_ctrl.textChanged.connect( self.EventText )
        
        self._text_ctrl_widget_event_filter.EVT_KEY_DOWN( self.keyPressFilter )
        
        self._text_ctrl.installEventFilter( self )
        
        self._main_vbox = QP.VBoxLayout( margin = 0 )
        
        self._SetupTopListBox()
        
        self._text_input_hbox = QP.HBoxLayout()
        
        QP.AddToLayout( self._text_input_hbox, self._text_ctrl, CC.FLAGS_VCENTER_EXPAND_DEPTH_ONLY )
        
        self._text_input_panel.setLayout( self._text_input_hbox )
        
        QP.AddToLayout( self._main_vbox, self._text_input_panel, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        
        if self._float_mode:
            
            self._dropdown_window = QW.QFrame( self )
            
            self._dropdown_window.setWindowFlags( QC.Qt.Tool | QC.Qt.FramelessWindowHint )
            
            self._dropdown_window.setAttribute( QC.Qt.WA_ShowWithoutActivating )
            
            self._dropdown_window.setFrameStyle( QW.QFrame.Panel | QW.QFrame.Raised )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIPopupMessages.py View on Github external
def __init__( self, parent, job_key ):
        
        QW.QWidget.__init__( self, parent )
        
        self._yesno_open = False
        
        self._job_key = job_key
        
        self._message_window = PopupMessage( self, self, self._job_key )
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, self._message_window )
        
        self.setLayout( vbox )
        
        self._windows_hidden = []
        
        self._HideOtherWindows()
        
        self._message_pubbed = False
        
        self._update_job = HG.client_controller.CallRepeatingQtSafe( self, 0.25, 0.5, self.REPEATINGUpdate )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUICanvasHoverFrames.py View on Github external
st.setText( statement )
                
                if score > 0:
                    
                    colour = ( 0, 128, 0 )
                    
                elif score < 0:
                    
                    colour = ( 128, 0, 0 )
                    
                else:
                    
                    colour = ( 0, 0, 128 )
                    
                
                QP.SetForegroundColour( st, colour )
                
            else:
                
                if panel.isVisible():
                    
                    panel.hide()
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUISearch.py View on Github external
width = ClientGUIFunctions.ConvertTextToPixelWidth( self._collect_unmatched, 19 )
        
        self._collect_unmatched.setMinimumWidth( width )
        
        self._collect_unmatched.addItem( 'collect unmatched', True )
        self._collect_unmatched.addItem( 'leave unmatched', False )
        
        #
        
        self._collect_unmatched.SetValue( self._media_collect.collect_unmatched )
        
        #
        
        hbox = QP.HBoxLayout( margin = 0 )
        
        QP.AddToLayout( hbox, self._collect_comboctrl, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( hbox, self._collect_unmatched, CC.FLAGS_VCENTER )
        
        self.setLayout( hbox )
        
        #
        
        self._UpdateLabel()
        
        self._collect_unmatched.currentIndexChanged.connect( self.CollectValuesChanged )
        self._collect_comboctrl.itemChanged.connect( self.CollectValuesChanged )
        
        HG.client_controller.sub( self, 'SetCollectFromPage', 'set_page_collect' )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIStringPanels.py View on Github external
self._example_string.setText( example_string_override )
            
        
        self._conversions.UpdateDatas() # to refresh, now they are all in the list
        
        self._conversions.Sort()
        
        #
        
        rows = []
        
        rows.append( ( 'example string: ', self._example_string ) )
        
        gridbox = ClientGUICommon.WrapInGrid( self, rows )
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, conversions_panel, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( vbox, gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        
        self.widget().setLayout( vbox )
        
        #
        
        self._example_string.textChanged.connect( self.EventUpdate )