How to use the hydrus.client.gui.QtPorting.AddToLayout 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 / ClientGUICanvasHoverFrames.py View on Github external
top_button_hbox = QP.HBoxLayout()
        
        QP.AddToLayout( top_button_hbox, self._trash_button, CC.FLAGS_VCENTER )
        QP.AddToLayout( top_button_hbox, self._cog_button, CC.FLAGS_VCENTER )
        QP.AddToLayout( top_button_hbox, close_button, CC.FLAGS_VCENTER )
        
        navigation_button_hbox = QP.HBoxLayout()
        
        QP.AddToLayout( navigation_button_hbox, self._back_a_pair, CC.FLAGS_VCENTER )
        QP.AddToLayout( navigation_button_hbox, self._previous_button, CC.FLAGS_VCENTER )
        QP.AddToLayout( navigation_button_hbox, (20,20), CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( navigation_button_hbox, self._index_text, CC.FLAGS_VCENTER )
        QP.AddToLayout( navigation_button_hbox, (20,20), CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( navigation_button_hbox, self._next_button, CC.FLAGS_VCENTER )
        QP.AddToLayout( navigation_button_hbox, self._skip_a_pair, CC.FLAGS_VCENTER )
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, navigation_button_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        QP.AddToLayout( vbox, top_button_hbox, CC.FLAGS_BUTTON_SIZER )
        QP.AddToLayout( vbox, command_button_vbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        QP.AddToLayout( vbox, self._comparison_statements_vbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        
        self.setLayout( vbox )
        
        HG.client_controller.sub( self, 'SetDuplicatePair', 'canvas_new_duplicate_pair' )
        HG.client_controller.sub( self, 'SetIndexString', 'canvas_new_index_string' )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIDialogs.py View on Github external
Dialog.__init__( self, parent, 'how to set up the account?', position = 'center' )
        
        register_message = 'I want to initialise a new account with the server. I have a registration key (a key starting with \'r\').'
        
        self._register = QW.QPushButton( register_message, self )
        self._register.clicked.connect( self.EventRegister )
        
        setup_message = 'The account is already initialised; I just want to add it to this client. I have a normal access key.'
        
        self._setup = QW.QPushButton( setup_message, self )
        self._setup.clicked.connect( self.accept )
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, self._register, CC.FLAGS_EXPAND_PERPENDICULAR )
        QP.AddToLayout( vbox, QP.MakeQLabelWithAlignment('-or-', self, QC.Qt.AlignHCenter | QC.Qt.AlignVCenter ), CC.FLAGS_EXPAND_PERPENDICULAR )
        QP.AddToLayout( vbox, self._setup, CC.FLAGS_EXPAND_PERPENDICULAR )
        
        self.setLayout( vbox )
        
        size_hint = self.sizeHint()
        
        QP.SetInitialSize( self, size_hint )
        
        self._should_register = False
        
        HG.client_controller.CallAfterQtSafe( self._register, self._register.setFocus, QC.Qt.OtherFocusReason )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIImport.py View on Github external
QP.AddToLayout( hbox, self._files_pause_button, CC.FLAGS_VCENTER )
        
        imports_panel.Add( hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        imports_panel.Add( self._file_seed_cache_control, CC.FLAGS_EXPAND_PERPENDICULAR )
        imports_panel.Add( self._file_download_control, CC.FLAGS_EXPAND_PERPENDICULAR )
        
        #
        
        hbox_1 = QP.HBoxLayout()
        
        QP.AddToLayout( hbox_1, self._file_velocity_status, CC.FLAGS_VCENTER_EXPAND_DEPTH_ONLY )
        QP.AddToLayout( hbox_1, self._checking_pause_button, CC.FLAGS_VCENTER )
        
        hbox_2 = QP.HBoxLayout()
        
        QP.AddToLayout( hbox_2, self._watcher_status, CC.FLAGS_VCENTER_EXPAND_DEPTH_ONLY )
        QP.AddToLayout( hbox_2, self._check_now_button, CC.FLAGS_VCENTER )
        
        checker_panel.Add( hbox_1, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        checker_panel.Add( hbox_2, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        checker_panel.Add( self._gallery_seed_log_control, CC.FLAGS_EXPAND_PERPENDICULAR )
        checker_panel.Add( self._checker_options_button, CC.FLAGS_EXPAND_PERPENDICULAR )
        checker_panel.Add( self._checker_download_control, CC.FLAGS_EXPAND_PERPENDICULAR )
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, imports_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
        QP.AddToLayout( vbox, checker_panel, CC.FLAGS_EXPAND_PERPENDICULAR )
        
        self._options_panel.setLayout( vbox )
        
        self.Add( self._watcher_subject, CC.FLAGS_EXPAND_PERPENDICULAR )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUISearch.py View on Github external
self._sign = QP.RadioBox( self, choices = choices )
        
        self._num = QP.MakeQSpinBox( self, min=-99999999, max=99999999 )
        
        #
        
        self._namespace.setText( 'page' )
        self._sign.SetStringSelection( '>' )
        self._num.setValue( 0 )
        
        #
        
        hbox = QP.HBoxLayout()
        
        QP.AddToLayout( hbox, ClientGUICommon.BetterStaticText(self,'system:tag as number'), CC.FLAGS_VCENTER )
        QP.AddToLayout( hbox, self._namespace, CC.FLAGS_VCENTER )
        QP.AddToLayout( hbox, self._sign, CC.FLAGS_VCENTER )
        QP.AddToLayout( hbox, self._num, CC.FLAGS_VCENTER )
        
        hbox.addStretch( 1 )
        
        self.setLayout( hbox )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUICanvasMedia.py View on Github external
self._media = media
        
        vbox = QP.VBoxLayout()
        
        if self._media.GetLocationsManager().IsLocal() and self._media.GetMime() in HC.MIMES_WITH_THUMBNAILS:
            
            mime = self._media.GetMime()
            
            thumbnail_path = HG.client_controller.client_files_manager.GetThumbnailPath( self._media )
            
            qt_pixmap = ClientRendering.GenerateHydrusBitmap( thumbnail_path, mime ).GetQtPixmap()
            
            thumbnail_window = ClientGUICommon.BufferedWindowIcon( self, qt_pixmap )
            
            QP.AddToLayout( vbox, thumbnail_window, CC.FLAGS_CENTER )
            
        
        m_text = HC.mime_string_lookup[ media.GetMime() ]
        
        button = QW.QPushButton( 'open ' + m_text + ' externally', self )
        
        button.setFocusPolicy( QC.Qt.NoFocus )
        
        QP.AddToLayout( vbox, button, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        self.setLayout( vbox )
        
        self.setCursor( QG.QCursor( QC.Qt.PointingHandCursor ) )
        
        button.clicked.connect( self.LaunchFile )
github hydrusnetwork / hydrus / hydrus / client / gui / lists / ClientGUIListBoxes.py View on Github external
self._add_button = ClientGUICommon.BetterButton( self, 'add', self._Add )
        self._edit_button = ClientGUICommon.BetterButton( self, 'edit', self._Edit )
        self._delete_button = ClientGUICommon.BetterButton( self, 'delete', self._Delete )
        
        self._enabled_only_on_selection_buttons = []
        
        self._permitted_object_types = []
        
        #
        
        vbox = QP.VBoxLayout()
        
        self._buttons_hbox = QP.HBoxLayout()
        
        QP.AddToLayout( self._buttons_hbox, self._add_button, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( self._buttons_hbox, self._edit_button, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( self._buttons_hbox, self._delete_button, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        QP.AddToLayout( vbox, self._listbox, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( vbox, self._buttons_hbox, CC.FLAGS_EXPAND_PERPENDICULAR )
        
        self.setLayout( vbox )
        
        #
        
        ( width, height ) = ClientGUIFunctions.ConvertTextToPixels( self._listbox, ( 20, height_num_chars ) )
        
        self._listbox.setMinimumWidth( width )
        self._listbox.setMinimumHeight( height )
        
        #
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIShortcutControls.py View on Github external
self._command = ClientGUIApplicationCommand.ApplicationCommandWidget( self._command_panel, command, shortcuts_name )
        
        #
        
        self._shortcut.SetValue( shortcut )
        
        #
        
        self._shortcut_panel.Add( self._shortcut, CC.FLAGS_EXPAND_PERPENDICULAR )
        self._command_panel.Add( self._command, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        hbox = QP.HBoxLayout()
        
        QP.AddToLayout( hbox, self._shortcut_panel, CC.FLAGS_VCENTER )
        QP.AddToLayout( hbox, ClientGUICommon.BetterStaticText( self, '\u2192' ), CC.FLAGS_VCENTER )
        QP.AddToLayout( hbox, self._command_panel, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        self.widget().setLayout( hbox )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIACDropdown.py View on Github external
button_hbox_1 = QP.HBoxLayout()
        
        QP.AddToLayout( button_hbox_1, self._include_current_tags, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( button_hbox_1, self._include_pending_tags, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        sync_button_hbox = QP.HBoxLayout()
        
        QP.AddToLayout( sync_button_hbox, self._search_pause_play, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( sync_button_hbox, self._or_advanced, CC.FLAGS_VCENTER )
        QP.AddToLayout( sync_button_hbox, self._or_cancel, CC.FLAGS_VCENTER )
        QP.AddToLayout( sync_button_hbox, self._or_rewind, CC.FLAGS_VCENTER )
        
        button_hbox_2 = QP.HBoxLayout()
        
        QP.AddToLayout( button_hbox_2, self._file_repo_button, CC.FLAGS_EXPAND_BOTH_WAYS )
        QP.AddToLayout( button_hbox_2, self._tag_repo_button, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        vbox = QP.VBoxLayout()
        
        QP.AddToLayout( vbox, button_hbox_1, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        QP.AddToLayout( vbox, sync_button_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        QP.AddToLayout( vbox, button_hbox_2, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
        QP.AddToLayout( vbox, self._dropdown_notebook, CC.FLAGS_EXPAND_BOTH_WAYS )
        
        self._dropdown_window.setLayout( vbox )
        
        self._predicates_listbox.listBoxChanged.connect( self._SignalNewSearchState )
        
        self._include_current_tags.valueChanged.connect( self.SetIncludeCurrent )
        self._include_pending_tags.valueChanged.connect( self.SetIncludePending )
        self._search_pause_play.valueChanged.connect( self.SetSynchronised )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUISearch.py View on Github external
vbox = QP.VBoxLayout()
        
        if label is not None:
            
            st = ClientGUICommon.BetterStaticText( self, label = label )
            
            st.setWordWrap( True )
            
            QP.AddToLayout( vbox, st, CC.FLAGS_EXPAND_PERPENDICULAR )
            
        
        for button in static_pred_buttons:
            
            QP.AddToLayout( vbox, button, CC.FLAGS_EXPAND_PERPENDICULAR )
            
        
        for pred_class in editable_pred_panel_classes:
            
            panel = self._EditablePredPanel( self, pred_class )
            
            QP.AddToLayout( vbox, panel, CC.FLAGS_EXPAND_PERPENDICULAR )
            
        
        if len( static_pred_buttons ) > 0 and len( editable_pred_panel_classes ) == 0:
            
            HG.client_controller.CallAfterQtSafe( static_pred_buttons[0], static_pred_buttons[0].setFocus, QC.Qt.OtherFocusReason )
            
        
        self.widget().setLayout( vbox )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIStringPanels.py View on Github external
rows = []
            
            rows.append( ( 'example string: ', self._example_string ) )
            rows.append( ( 'converted string: ', self._example_conversion ) )
            
            self._example_gridbox = ClientGUICommon.WrapInGrid( self._example_panel, rows )
            
            self._example_panel.Add( self._example_gridbox, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS )
            
            #
            
            vbox = QP.VBoxLayout()
            
            QP.AddToLayout( vbox, self._control_panel, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
            QP.AddToLayout( vbox, self._example_panel, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR )
            QP.AddToLayout( vbox, QW.QWidget( self ), CC.FLAGS_EXPAND_BOTH_WAYS )
            
            self.widget().setLayout( vbox )
            
            self._UpdateDataControls()
            
            #
            
            self._conversion_type.currentIndexChanged.connect( self._UpdateDataControls )
            self._conversion_type.currentIndexChanged.connect( self._UpdateExampleText )
            
            self._data_text.textEdited.connect( self._UpdateExampleText )
            self._data_number.valueChanged.connect( self._UpdateExampleText )
            self._data_encoding.currentIndexChanged.connect( self._UpdateExampleText )
            self._data_regex_repl.textEdited.connect( self._UpdateExampleText )
            self._data_timezone_decode.currentIndexChanged.connect( self._UpdateExampleText )