def __init__(self, parent: QW.QWidget, dictionary): ClientGUICommon.StaticBox.__init__(self, parent, 'file repository') self._log_uploader_ips = QW.QCheckBox(self) self._max_storage = ClientGUIControls.NoneableBytesControl( self, initial_value=5 * 1024 * 1024 * 1024) # log_uploader_ips = dictionary['log_uploader_ips'] max_storage = dictionary['max_storage'] self._log_uploader_ips.setChecked(log_uploader_ips) self._max_storage.SetValue(max_storage) # rows = [] rows.append( ('log file uploader IP addresses?: ', self._log_uploader_ips)) rows.append(('max file storage: ', self._max_storage)) gridbox = ClientGUICommon.WrapInGrid(self, rows) self.Add(gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR)
def __init__( self, parent: QW.QWidget, dictionary ): QW.QWidget.__init__( self, parent ) bandwidth_rules = dictionary[ 'bandwidth_rules' ] self._bandwidth_rules = ClientGUIControls.BandwidthRulesCtrl( self, bandwidth_rules ) # vbox = QP.VBoxLayout() QP.AddToLayout( vbox, self._bandwidth_rules, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) self.setLayout( vbox )
def __init__( self, parent: QW.QWidget, dictionary ): ClientGUICommon.StaticBox.__init__( self, parent, 'server-wide bandwidth' ) self._bandwidth_tracker_st = ClientGUICommon.BetterStaticText( self ) bandwidth_rules = dictionary[ 'server_bandwidth_rules' ] self._bandwidth_rules = ClientGUIControls.BandwidthRulesCtrl( self, bandwidth_rules ) # bandwidth_tracker = dictionary[ 'server_bandwidth_tracker' ] bandwidth_text = bandwidth_tracker.GetCurrentMonthSummary() self._bandwidth_tracker_st.setText( bandwidth_text ) # self.Add( self._bandwidth_tracker_st, CC.FLAGS_EXPAND_PERPENDICULAR ) self.Add( self._bandwidth_rules, CC.FLAGS_EXPAND_PERPENDICULAR )
def __init__( self, parent: QW.QWidget, service_type: int, account_type: HydrusNetwork.AccountType ): ClientGUIScrolledPanels.EditPanel.__init__( self, parent ) self._account_type_key = account_type.GetAccountTypeKey() title = account_type.GetTitle() permissions = account_type.GetPermissions() bandwidth_rules = account_type.GetBandwidthRules() auto_create_velocity = account_type.GetAutoCreateAccountVelocity() self._auto_create_history = account_type.GetAutoCreateAccountHistory() self._title = QW.QLineEdit( self ) permission_choices = self._GeneratePermissionChoices( service_type ) self._permission_controls = [] self._permissions_panel = ClientGUICommon.StaticBox( self, 'permissions' ) gridbox_rows = [] for ( content_type, action_rows ) in permission_choices: choice_control = ClientGUICommon.BetterChoice( self._permissions_panel ) for ( label, action ) in action_rows: choice_control.addItem( label, (content_type, action) ) if content_type in permissions: selection_row = ( content_type, permissions[ content_type ] ) else: selection_row = ( content_type, None ) try: choice_control.SetValue( selection_row ) except: choice_control.SetValue( ( content_type, None ) ) self._permission_controls.append( choice_control ) gridbox_label = HC.content_type_string_lookup[ content_type ] gridbox_rows.append( ( gridbox_label, choice_control ) ) gridbox = ClientGUICommon.WrapInGrid( self._permissions_panel, gridbox_rows ) self._bandwidth_rules_control = ClientGUIControls.BandwidthRulesCtrl( self, bandwidth_rules ) self._auto_creation_box = ClientGUICommon.StaticBox( self, 'automatic account creation' ) min_unit_value = 0 max_unit_value = 65565 min_time_delta = 60 * 60 self._auto_create_velocity_control = ClientGUITime.VelocityCtrl( self._auto_creation_box, min_unit_value, max_unit_value, min_time_delta, days = True, hours = True, unit = 'accounts' ) self._auto_create_history_st = ClientGUICommon.BetterStaticText( self._auto_creation_box, label = 'initialising' ) # self._title.setText( title ) self._auto_create_velocity_control.SetValue( auto_create_velocity ) # intro = 'If you wish, you can allow new users to create their own accounts. They will be limited to a certain number over a particular time.' intro += os.linesep * 2 intro += 'Set to 0 to disable auto-creation.' st = ClientGUICommon.BetterStaticText( self._auto_creation_box, label = intro ) st.setWordWrap( True ) self._auto_creation_box.Add( st, CC.FLAGS_EXPAND_PERPENDICULAR ) self._auto_creation_box.Add( self._auto_create_history_st, CC.FLAGS_EXPAND_PERPENDICULAR ) self._auto_creation_box.Add( self._auto_create_velocity_control, CC.FLAGS_EXPAND_PERPENDICULAR ) t_hbox = ClientGUICommon.WrapInText( self._title, self, 'title: ' ) self._permissions_panel.Add( gridbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) vbox = QP.VBoxLayout() QP.AddToLayout( vbox, t_hbox, CC.FLAGS_EXPAND_SIZER_PERPENDICULAR ) QP.AddToLayout( vbox, self._permissions_panel, CC.FLAGS_EXPAND_PERPENDICULAR ) QP.AddToLayout( vbox, self._bandwidth_rules_control, CC.FLAGS_EXPAND_PERPENDICULAR ) QP.AddToLayout( vbox, self._auto_creation_box, CC.FLAGS_EXPAND_PERPENDICULAR ) self.widget().setLayout( vbox ) # self._UpdateAutoCreationHistoryText() self._auto_create_velocity_control.velocityChanged.connect( self._UpdateAutoCreationHistoryText )