def __init__(self, canvasDlg, widgetInfo, *args): WidgetListBase.__init__(self, canvasDlg, widgetInfo) QDockWidget.__init__(self, "Widgets") self.actions = categoriesPopup.allActions self.toolbox = MyQToolBox(canvasDlg.settings["toolboxWidth"], self) self.toolbox.setFocusPolicy( Qt.ClickFocus ) # this is needed otherwise the document window will sometimes strangely lose focus and the output window will be focused self.toolbox.layout().setSpacing(0) # a widget container to hold the search area and the widget tree self.containerWidget = QWidget() containerBoxLayout = QBoxLayout(QBoxLayout.TopToBottom, self.containerWidget) if sys.platform == "darwin": containerBoxLayout.setContentsMargins(0, 0, 0, 0) self.widgetSuggestEdit = OWGUIEx.lineEditHint( self, None, None, useRE=0, caseSensitive=0, matchAnywhere=1, autoSizeListWidget=1, callback=self.widgetSuggestCallback) self.widgetSuggestEdit.setItems([ QListWidgetItem(action.icon(), action.widgetInfo.name) for action in self.actions ]) containerBoxLayout.insertWidget(0, self.widgetSuggestEdit) containerBoxLayout.insertWidget(1, self.toolbox) self.setWidget(self.containerWidget)
def __init__(self, canvasDlg, widgetInfo, *args): WidgetListBase.__init__(self, canvasDlg, widgetInfo) QDockWidget.__init__(self, "Widgets") self.treeWidget = MyTreeWidget(canvasDlg, self) self.treeWidget.tabDict = self.tabDict self.treeWidget.setFocusPolicy( Qt.ClickFocus ) # this is needed otherwise the document window will sometimes strangely lose focus and the output window will be focused self.actions = categoriesPopup.allActions # a widget container to hold the search area and the widget tree self.containerWidget = QWidget() containerBoxLayout = QBoxLayout(QBoxLayout.TopToBottom, self.containerWidget) self.widgetSuggestEdit = OWGUIEx.lineEditHint( self, None, None, useRE=0, caseSensitive=0, matchAnywhere=1, autoSizeListWidget=1, callback=self.widgetSuggestCallback) self.widgetSuggestEdit.setItems([ QListWidgetItem(action.icon(), action.widgetInfo.name) for action in self.actions ]) containerBoxLayout.insertWidget(0, self.widgetSuggestEdit) containerBoxLayout.insertWidget(1, self.treeWidget) self.setWidget(self.containerWidget) iconSize = self.canvasDlg.toolbarIconSizeList[ self.canvasDlg.settings["toolbarIconSize"]] self.treeWidget.setIconSize(QSize(iconSize, iconSize))
def __init__(self, parent=None): OWWidget.__init__(self, parent, title='Line Edit as Filter', wantMainArea=0) self.text = "" s = OWGUIEx.lineEditHint(self.controlArea, self, "text", useRE=0, caseSensitive=0, matchAnywhere=0) s.listWidget.setSpacing(2) s.setStyleSheet( """ QLineEdit { background: #fffff0; border: 1px solid blue} """) s.listWidget.setStyleSheet( """ QListView { background: #fffff0; } QListView::item {padding: 3px 0px 3px 0px} QListView::item:selected, QListView::item:hover { color: white; background: blue;} """ ) cats = orngRegistry.readCategories() items = [] for cat in cats.values(): for widget in cat.values(): iconNames = getFullWidgetIconName(cat, widget) icon = QIcon() for name in iconNames: icon.addPixmap(QPixmap(name)) item = QListWidgetItem(icon, widget.name) #item.setSizeHint(QSize(100, 32)) # items.append(item) s.setItems(items)
def __init__(self, parent, actions): QWidgetAction.__init__(self, parent) self.parent = parent self.actions = actions self.widgetSuggestEdit = OWGUIEx.lineEditHint(self.parent, None, None, useRE = 0, caseSensitive = 0, matchAnywhere = 1, callback = self.callback, autoSizeListWidget = 1) self.widgetSuggestEdit.setItems([QListWidgetItem(action.icon(), action.widgetInfo.name) for action in actions]) self.widgetSuggestEdit.setStyleSheet(""" QLineEdit { background: #fffff0; border: 1px solid orange} """) self.widgetSuggestEdit.listWidget.setStyleSheet(""" QListView { background: #fffff0; } QListView::item {padding: 3px 0px 3px 0px} QListView::item:selected { color: white; background: blue;} """) self.widgetSuggestEdit.listWidget.setIconSize(QSize(16,16)) self.setDefaultWidget(self.widgetSuggestEdit) self._in_callback = False
def __init__(self, parent=None, signalManager=None, name="Databases update", wantCloseButton=False, searchString="", showAll=True, domains=None, accessCode=""): OWWidget.__init__(self, parent, signalManager, name) self.searchString = searchString self.accessCode = accessCode self.showAll = showAll self.domains = domains self.serverFiles = orngServerFiles.ServerFiles() box = OWGUI.widgetBox(self.mainArea, orientation="horizontal") import OWGUIEx self.lineEditFilter = OWGUIEx.lineEditHint(box, self, "searchString", "Filter", caseSensitive=False, delimiters=" ", matchAnywhere=True, listUpdateCallback=self.SearchUpdate, callbackOnType=True, callback=self.SearchUpdate) box = OWGUI.widgetBox(self.mainArea, "Files") self.filesView = QTreeWidget(self) self.filesView.setHeaderLabels(["Options", "Title", "Size"]) self.filesView.setRootIsDecorated(False) self.filesView.setSelectionMode(QAbstractItemView.NoSelection) self.filesView.setSortingEnabled(True) self.filesView.setItemDelegate(UpdateItemDelegate(self.filesView)) self.connect(self.filesView.model(), SIGNAL("layoutChanged()"), self.SearchUpdate) box.layout().addWidget(self.filesView) box = OWGUI.widgetBox(self.mainArea, orientation="horizontal") OWGUI.button(box, self, "Update all local files", callback=self.UpdateAll, tooltip="Update all updatable files") OWGUI.button(box, self, "Download filtered", callback=self.DownloadFiltered, tooltip="Download all filtered files shown") OWGUI.rubber(box) OWGUI.lineEdit(box, self, "accessCode", "Access Code", orientation="horizontal", callback=self.RetrieveFilesList) self.retryButton = OWGUI.button(box, self, "Retry", callback=self.RetrieveFilesList) self.retryButton.hide() box = OWGUI.widgetBox(self.mainArea, orientation="horizontal") OWGUI.rubber(box) if wantCloseButton: OWGUI.button(box, self, "Close", callback=self.accept, tooltip="Close") ## statusBar = QStatusBar() self.infoLabel = QLabel() self.infoLabel.setAlignment(Qt.AlignCenter) ## statusBar.addWidget(self.infoLabel) ## self.mainArea.layout().addWidget(statusBar) self.mainArea.layout().addWidget(self.infoLabel) self.infoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.updateItems = [] self.allTags = [] self.resize(800, 600) # QTimer.singleShot(50, self.UpdateFilesList) QTimer.singleShot(50, self.RetrieveFilesList)
def __init__(self, canvasDlg, widgetInfo, *args): WidgetListBase.__init__(self, canvasDlg, widgetInfo) QDockWidget.__init__(self, "Widgets") self.actions = categoriesPopup.allActions self.toolbox = MyQToolBox(canvasDlg.settings["toolboxWidth"], self) self.toolbox.setFocusPolicy(Qt.ClickFocus) # this is needed otherwise the document window will sometimes strangely lose focus and the output window will be focused self.toolbox.layout().setSpacing(0) # a widget container to hold the search area and the widget tree self.containerWidget = QWidget() containerBoxLayout = QBoxLayout(QBoxLayout.TopToBottom, self.containerWidget) if sys.platform == "darwin": containerBoxLayout.setContentsMargins(0, 0, 0, 0) self.widgetSuggestEdit = OWGUIEx.lineEditHint(self, None, None, useRE = 0, caseSensitive = 0, matchAnywhere = 1, autoSizeListWidget = 1, callback = self.widgetSuggestCallback) self.widgetSuggestEdit.setItems([QListWidgetItem(action.icon(), action.widgetInfo.name) for action in self.actions]) containerBoxLayout.insertWidget(0, self.widgetSuggestEdit) containerBoxLayout.insertWidget(1, self.toolbox) self.setWidget(self.containerWidget)
def __init__(self, parent=None): OWWidget.__init__(self, parent, title='Line Edit as Filter', wantMainArea = 0) self.text = "" s = OWGUIEx.lineEditHint(self.controlArea, self, "text", useRE = 0, caseSensitive = 0, matchAnywhere = 0) s.listWidget.setSpacing(2) s.setStyleSheet(""" QLineEdit { background: #fffff0; border: 1px solid blue} """) s.listWidget.setStyleSheet(""" QListView { background: #fffff0; } QListView::item {padding: 3px 0px 3px 0px} QListView::item:selected, QListView::item:hover { color: white; background: blue;} """) cats = orngRegistry.readCategories() items = [] for cat in cats.values(): for widget in cat.values(): iconNames = getFullWidgetIconName(cat, widget) icon = QIcon() for name in iconNames: icon.addPixmap(QPixmap(name)) item = QListWidgetItem(icon, widget.name) #item.setSizeHint(QSize(100, 32)) # items.append(item) s.setItems(items)
def __init__(self, parent, actions): QWidgetAction.__init__(self, parent) self.parent = parent self.actions = actions self.widgetSuggestEdit = OWGUIEx.lineEditHint(self.parent, None, None, useRE=0, caseSensitive=0, matchAnywhere=1, callback=self.callback, autoSizeListWidget=1) self.widgetSuggestEdit.setItems([ QListWidgetItem(action.icon(), action.widgetInfo.name) for action in actions ]) self.widgetSuggestEdit.setStyleSheet( """ QLineEdit { background: #fffff0; border: 1px solid orange} """) self.widgetSuggestEdit.listWidget.setStyleSheet( """ QListView { background: #fffff0; } QListView::item {padding: 3px 0px 3px 0px} QListView::item:selected { color: white; background: blue;} """ ) self.widgetSuggestEdit.listWidget.setIconSize(QSize(16, 16)) self.setDefaultWidget(self.widgetSuggestEdit)
def __init__(self, parent=None, signalManager=None, name="Databases update", wantCloseButton=False, searchString="", showAll=True, domains=None, accessCode=""): OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False) self.searchString = searchString self.accessCode = accessCode self.showAll = showAll self.domains = domains self.serverFiles = serverfiles.ServerFiles() box = OWGUI.widgetBox(self.controlArea, orientation="horizontal") self.lineEditFilter = \ OWGUIEx.lineEditHint(box, self, "searchString", "Filter", caseSensitive=False, delimiters=" ", matchAnywhere=True, listUpdateCallback=self.SearchUpdate, callbackOnType=True, callback=self.SearchUpdate) box = OWGUI.widgetBox(self.controlArea, "Files") self.filesView = QTreeWidget(self) self.filesView.setHeaderLabels( ["", "Data Source", "Update", "Last Updated", "Size"]) self.filesView.setRootIsDecorated(False) self.filesView.setUniformRowHeights(True) self.filesView.setSelectionMode(QAbstractItemView.NoSelection) self.filesView.setSortingEnabled(True) self.filesView.sortItems(1, Qt.AscendingOrder) self.filesView.setItemDelegateForColumn( 0, UpdateOptionsItemDelegate(self.filesView)) QObject.connect(self.filesView.model(), SIGNAL("layoutChanged()"), self.SearchUpdate) box.layout().addWidget(self.filesView) box = OWGUI.widgetBox(self.controlArea, orientation="horizontal") self.updateButton = OWGUI.button(box, self, "Update all", callback=self.UpdateAll, tooltip="Update all updatable files", ) self.downloadButton = OWGUI.button(box, self, "Download all", callback=self.DownloadFiltered, tooltip="Download all filtered files shown") self.cancelButton = OWGUI.button(box, self, "Cancel", callback=self.Cancel, tooltip="Cancel scheduled downloads/updates.") OWGUI.rubber(box) OWGUI.lineEdit(box, self, "accessCode", "Access Code", orientation="horizontal", callback=self.RetrieveFilesList) self.retryButton = OWGUI.button(box, self, "Retry", callback=self.RetrieveFilesList) self.retryButton.hide() box = OWGUI.widgetBox(self.controlArea, orientation="horizontal") OWGUI.rubber(box) if wantCloseButton: OWGUI.button(box, self, "Close", callback=self.accept, tooltip="Close") self.infoLabel = QLabel() self.infoLabel.setAlignment(Qt.AlignCenter) self.controlArea.layout().addWidget(self.infoLabel) self.infoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) self.updateItems = [] self.resize(800, 600) self.progress = ProgressState(self, maximum=3) self.progress.valueChanged.connect(self._updateProgress) self.progress.rangeChanged.connect(self._updateProgress) self.executor = ThreadExecutor( threadPool=QThreadPool(maxThreadCount=2) ) task = Task(self, function=self.RetrieveFilesList) task.exceptionReady.connect(self.HandleError) task.start() self._tasks = [] self._haveProgress = False