def __init__(self, parent=None): super(LibrarySearchWidget, self).__init__(parent=parent) self._library = None self._space_operator = 'and' search_icon = tpQtLib.resource.icon('search', theme='black') self._icon_btn = buttons.IconButton(search_icon, icon_padding=2, parent=self) self._icon_btn.clicked.connect(self._on_icon_clicked) self.set_icon(search_icon) cross_icon = tpQtLib.resource.icon('delete', theme='black') self._clear_btn = buttons.IconButton(cross_icon, icon_padding=2, parent=self) self._clear_btn.setCursor(Qt.ArrowCursor) self._clear_btn.setToolTip('Clear all search text') self._clear_btn.clicked.connect(self._on_clear_clicked) self.setPlaceholderText(self.PLACEHOLDER_TEXT) self.textChanged.connect(self._on_text_changed) self.update() tip = 'Search all current items' self.setToolTip(tip) self.setStatusTip(tip) self.setStyleSheet('border-radius: 10px; padding-left: 2px; padding-right: 2px; border: 2px;')
def __init__(self, label_text='Select Folder', directory='', use_app_browser=False, use_icon=True, parent=None): super(SelectFolder, self).__init__(parent) self._use_app_browser = use_app_browser self._use_icon = use_icon self.settings = None self.directory = None self._label_text = label_text self._directory = directory main_layout = QHBoxLayout() main_layout.setContentsMargins(2, 2, 2, 2) main_layout.setSpacing(2) self.setLayout(main_layout) self._folder_label = QLabel('{0}'.format( self._label_text)) if self._label_text == '' else QLabel( '{0}:'.format(self._label_text)) self._folder_line = FolderEditLine() self._folder_line.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) if os.path.exists(self._directory): self._folder_line.setText(self._directory) if self._use_icon: folder_icon = tpQtLib.resource.icon('folder') self._folder_btn = buttons.IconButton( icon=folder_icon, icon_padding=2, button_style=buttons.ButtonStyles.FlatStyle) else: self._folder_btn = buttons.BaseButton('Browse...') self._folder_btn.setMaximumHeight(20) for widget in [ self._folder_label, self._folder_line, self._folder_btn ]: main_layout.addWidget(widget) self._folder_btn.clicked.connect(self._open_folder_browser_dialog)
def ui(self): super(EditFileTreeWidget, self).ui() self.tree_widget = self.TREE_WIDGET() self.manager_widget = self.MANAGER_WIDGET() self.manager_widget.set_tree_widget(self.tree_widget) self.filter_widget = self.FILTER_WIDGET() self.filter_widget.set_tree_widget(self.tree_widget) self.filter_widget.set_directory(self.directory) drag_reorder_icon = tpQtLib.resource.icon('drag_reorder') self.edit_mode_btn = buttons.IconButton(icon=drag_reorder_icon, icon_padding=2, button_style=buttons.ButtonStyles.FlatStyle) self.edit_mode_btn.setCheckable(True) self.edit_mode_btn.setMaximumHeight(20) self.edit_mode_btn.setMaximumWidth(40) self.filter_widget.main_layout.addWidget(self.edit_mode_btn) self.main_layout.addWidget(self.filter_widget) self.main_layout.addWidget(self.tree_widget) self.main_layout.addWidget(self.manager_widget) self._on_edit(False)
def __init__(self, text='Browse', directory='', use_app_browser=False, parent=None): super(SelectFolderButton, self).__init__(parent) self._use_app_browser = use_app_browser self._directory = directory self.settings = None main_layout = QHBoxLayout() main_layout.setContentsMargins(2, 2, 2, 2) main_layout.setSpacing(2) self.setLayout(main_layout) folder_icon = tpQtLib.resource.icon('folder') self._folder_btn = buttons.IconButton( icon=folder_icon, icon_padding=2, button_style=buttons.ButtonStyles.FlatStyle) main_layout.addWidget(self._folder_btn) self._folder_btn.clicked.connect(self._open_folder_browser_dialog)
def __init__(self, parent=None): super(SearchFindWidget, self).__init__(parent=parent) self.setObjectName('SearchFindWidget') self.text = '' self._placeholder_text = '' main_layout = QHBoxLayout() main_layout.setContentsMargins(2, 2, 2, 2) main_layout.setSpacing(2) self.setLayout(main_layout) self._search_line = QLineEdit(self) self._search_menu = QMenu() self._search_menu.addAction('Test') icon_size = self.style().pixelMetric(QStyle.PM_SmallIconSize) delete_icon = resource.Resource.icon('delete', extension='png') search_icon = resource.Resource.icon('search', extension='png') self._clear_btn = buttons.IconButton(delete_icon, icon_padding=2, parent=self) self._clear_btn.setIconSize(QSize(icon_size, icon_size)) self._clear_btn.setFixedSize(QSize(icon_size, icon_size)) self._clear_btn.hide() self._search_btn = buttons.IconButton(search_icon, icon_padding=2, parent=self) self._search_btn.setIconSize(QSize(icon_size, icon_size)) self._search_btn.setFixedSize(QSize(icon_size, icon_size)) # self._search_btn.setStyleSheet('border: none;') # self._search_btn.setPopupMode(QToolButton.InstantPopup) self._search_btn.setEnabled(True) self._search_line.setStyleSheet(""" QLineEdit { padding-left: %spx; padding-right: %spx; border-radius:10px; border:2px; border-color:red; } """ % (self._search_button_padded_width(), self._clear_button_padded_width())) self._search_line.setMinimumSize( max( self._search_line.minimumSizeHint().width(), self._clear_button_padded_width() + self._search_button_padded_width()), max( self._search_line.minimumSizeHint().height(), max(self._clear_button_padded_width(), self._search_button_padded_width()))) main_layout.addWidget(self._search_line) self._search_line.setFocus() self._search_line.textChanged.connect(self.textChanged) self._search_line.textChanged.connect(self.set_text) # self._search_line.editingFinished.connect(self.editingFinished) # self._search_line.returnPressed.connect(self.returnPressed) self._clear_btn.clicked.connect(self.clear) self._search_btn.clicked.connect(self._popup_menu)