def __init__(self, parent, bandwidth_rules): ClientGUICommon.StaticBox.__init__(self, parent, 'bandwidth rules') listctrl_panel = ClientGUIListCtrl.BetterListCtrlPanel(self) columns = [('max allowed', 14), ('every', 16)] self._listctrl = ClientGUIListCtrl.BetterListCtrl( listctrl_panel, 'bandwidth_rules', 8, 10, columns, self._ConvertRuleToListCtrlTuples, use_simple_delete=True, activation_callback=self._Edit) 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(bandwidth_rules.GetRules()) self._listctrl.Sort(0) # self.Add(listctrl_panel, CC.FLAGS_EXPAND_BOTH_WAYS)
def __init__( self, parent, initial_dict: typing.Dict[ str, ClientParsing.StringMatch ], min_height = 10, key_name = 'key' ): QW.QWidget.__init__( self, parent ) self._key_name = key_name listctrl_panel = ClientGUIListCtrl.BetterListCtrlPanel( self ) columns = [ ( self._key_name, 20 ), ( 'matching', -1 ) ] self._listctrl = ClientGUIListCtrl.BetterListCtrl( listctrl_panel, 'key_to_string_match', min_height, 36, columns, self._ConvertDataToListCtrlTuples, use_simple_delete = True, activation_callback = self._Edit ) 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( initial_dict.items() ) self._listctrl.Sort( 0 ) # vbox = QP.VBoxLayout() QP.AddToLayout( vbox, listctrl_panel, CC.FLAGS_EXPAND_BOTH_WAYS ) self.setLayout( vbox )
def __init__(self, parent, favourite_searches_rows, initial_search_row_to_edit=None): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._favourite_searches_panel = ClientGUIListCtrl.BetterListCtrlPanel( self) columns = [('folder', 24), ('name', 24), ('search', -1), ('sort', 24), ('collect', 24)] self._favourite_searches = ClientGUIListCtrl.BetterListCtrl( self._favourite_searches_panel, 'favourite_searches', 20, 72, columns, self._ConvertRowToListCtrlTuples, use_simple_delete=True, activation_callback=self._EditFavouriteSearch) self._favourite_searches_panel.SetListCtrl(self._favourite_searches) self._favourite_searches_panel.AddButton('add', self._AddNewFavouriteSearch) self._favourite_searches_panel.AddButton( 'edit', self._EditFavouriteSearch, enabled_only_on_selection=True) self._favourite_searches_panel.AddDeleteButton() # self._favourite_searches.AddDatas(favourite_searches_rows) self._favourite_searches.Sort(0) # vbox = QP.VBoxLayout() QP.AddToLayout(vbox, self._favourite_searches_panel, CC.FLAGS_EXPAND_BOTH_WAYS) self.widget().setLayout(vbox) if initial_search_row_to_edit is not None: HG.client_controller.CallLaterQtSafe(self, 0.5, self._AddNewFavouriteSearch, initial_search_row_to_edit)
def __init__( self, parent ): title = 'manage local upnp' ClientGUIDialogs.Dialog.__init__( self, parent, title ) self._status_st = ClientGUICommon.BetterStaticText( self ) listctrl_panel = ClientGUIListCtrl.BetterListCtrlPanel( self ) columns = [ ( 'description', -1 ), ( 'internal ip', 17 ), ( 'internal port', 7 ), ( 'external port', 7 ), ( 'prototcol', 5 ), ( 'lease', 12 ) ] self._mappings_list_ctrl = ClientGUIListCtrl.BetterListCtrl( listctrl_panel, 'manage_upnp_mappings', 12, 36, columns, 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 = [] self._mappings_list_ctrl.Sort( 0 ) self._started_external_ip_fetch = False self._RefreshMappings()
def __init__( self, parent, initial_dict: typing.Dict[ str, str ], min_height = 10, key_name = 'key', value_name = 'value', allow_add_delete = True, edit_keys = True ): QW.QWidget.__init__( self, parent ) self._key_name = key_name self._value_name = value_name self._edit_keys = edit_keys listctrl_panel = ClientGUIListCtrl.BetterListCtrlPanel( self ) columns = [ ( self._key_name, 20 ), ( self._value_name, -1 ) ] use_simple_delete = allow_add_delete self._listctrl = ClientGUIListCtrl.BetterListCtrl( listctrl_panel, 'key_to_value', min_height, 36, columns, self._ConvertDataToListCtrlTuples, use_simple_delete = use_simple_delete, activation_callback = self._Edit ) self._listctrl.listCtrlChanged.connect( self.listCtrlChanged ) listctrl_panel.SetListCtrl( self._listctrl ) if allow_add_delete: listctrl_panel.AddButton( 'add', self._Add ) listctrl_panel.AddButton( 'edit', self._Edit, enabled_only_on_selection = True ) if allow_add_delete: listctrl_panel.AddDeleteButton() # self._listctrl.AddDatas( list(initial_dict.items()) ) self._listctrl.Sort( 0 ) # vbox = QP.VBoxLayout() QP.AddToLayout( vbox, listctrl_panel, CC.FLAGS_EXPAND_BOTH_WAYS ) self.setLayout( vbox )
def __init__(self, parent, export_folders): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._export_folders_panel = ClientGUIListCtrl.BetterListCtrlPanel( self) columns = [('name', 20), ('path', -1), ('type', 12), ('query', 16), ('paused', 8), ('period', 16), ('phrase', 20)] self._export_folders = ClientGUIListCtrl.BetterListCtrl( self._export_folders_panel, 'export_folders', 6, 40, columns, self._ConvertExportFolderToListCtrlTuples, use_simple_delete=True, activation_callback=self._Edit) self._export_folders_panel.SetListCtrl(self._export_folders) self._export_folders_panel.AddButton('add', self._AddFolder) self._export_folders_panel.AddButton('edit', self._Edit, enabled_only_on_selection=True) self._export_folders_panel.AddDeleteButton() # self._export_folders.AddDatas(export_folders) self._export_folders.Sort(0) vbox = QP.VBoxLayout() intro = 'Here you can set the client to regularly export a certain query to a particular location.' QP.AddToLayout(vbox, ClientGUICommon.BetterStaticText(self, intro), CC.FLAGS_EXPAND_PERPENDICULAR) QP.AddToLayout(vbox, self._export_folders_panel, CC.FLAGS_EXPAND_BOTH_WAYS) self.widget().setLayout(vbox)
def __init__(self, parent, shortcuts: ClientGUIShortcuts.ShortcutSet): ClientGUIScrolledPanels.EditPanel.__init__(self, parent) self._name = QW.QLineEdit(self) self._shortcuts_panel = ClientGUIListCtrl.BetterListCtrlPanel(self) self._shortcuts = ClientGUIListCtrl.BetterListCtrl( self._shortcuts_panel, 'shortcuts', 20, 20, [('shortcut', 20), ('command', -1)], data_to_tuples_func=self._ConvertSortTupleToPrettyTuple, delete_key_callback=self.RemoveShortcuts, activation_callback=self.EditShortcuts) self._shortcuts_panel.SetListCtrl(self._shortcuts) self._shortcuts_panel.AddImportExportButtons( (ClientGUIShortcuts.ShortcutSet, ), self._AddShortcutSet, custom_get_callable=self._GetSelectedShortcutSet) self._shortcuts.setMinimumSize(QC.QSize(360, 480)) self._add = QW.QPushButton('add', self) self._add.clicked.connect(self.AddShortcut) self._edit = QW.QPushButton('edit', self) self._edit.clicked.connect(self.EditShortcuts) self._remove = QW.QPushButton('remove', self) self._remove.clicked.connect(self.RemoveShortcuts) # name = shortcuts.GetName() self._name.setText(name) self._this_is_custom = True if name in ClientGUIShortcuts.SHORTCUTS_RESERVED_NAMES: self._this_is_custom = False self._name.setEnabled(False) self._shortcuts.AddDatas(shortcuts) self._shortcuts.Sort(1) # action_buttons = QP.HBoxLayout() QP.AddToLayout(action_buttons, self._add, CC.FLAGS_VCENTER) QP.AddToLayout(action_buttons, self._edit, CC.FLAGS_VCENTER) QP.AddToLayout(action_buttons, self._remove, CC.FLAGS_VCENTER) vbox = QP.VBoxLayout() QP.AddToLayout(vbox, ClientGUICommon.WrapInText(self._name, self, 'name: '), CC.FLAGS_EXPAND_SIZER_PERPENDICULAR) if name in ClientGUIShortcuts.shortcut_names_to_descriptions: description_text = ClientGUIShortcuts.shortcut_names_to_descriptions[ name] description = ClientGUICommon.BetterStaticText( self, description_text, description_text) description.setWordWrap(True) QP.AddToLayout(vbox, description, CC.FLAGS_EXPAND_PERPENDICULAR) QP.AddToLayout(vbox, self._shortcuts_panel, CC.FLAGS_EXPAND_BOTH_WAYS) QP.AddToLayout(vbox, action_buttons, CC.FLAGS_BUTTON_SIZER) self.widget().setLayout(vbox)