def __init__(self, iface): # QGIS self.iface = iface self.settings = MySettings() self.linkRubber = QgsRubberBand(self.iface.mapCanvas()) self.featureHighlight = None # Relation management self.relationManager = QgsProject.instance().relationManager() self.relationManager.changed.connect(self.loadRelations) self.relation = QgsRelation() self.referencingFeature = QgsFeature() self.relationWidgetWrapper = None self.editorContext = QgsAttributeEditorContext() self.editorContext.setVectorLayerTools(self.iface.vectorLayerTools()) # GUI QDockWidget.__init__(self) self.setupUi(self) SettingDialog.__init__(self, MySettings(), False, True) self.drawButton.setChecked(self.settings.value("drawEnabled")) self.relationReferenceWidget.setAllowMapIdentification(True) self.relationReferenceWidget.setEmbedForm(False) self.mapTool = QgsMapToolIdentifyFeature(self.iface.mapCanvas()) self.mapTool.setButton(self.identifyReferencingFeatureButton) # Connect signal/slot self.relationComboBox.currentIndexChanged.connect(self.currentRelationChanged) self.mapTool.featureIdentified.connect(self.setReferencingFeature) # load relations at start self.loadRelations()
def __init__(self, data, scheme, parent=None): super(NodeWindow, self).__init__(parent) self.pathWidget = PathWidget(self.openWidgetByPath, data.path()) self.setStatusBar(self.pathWidget) # layout_set_sm_and_mrg(self.layout) self.cachedWidgets = {} self.currentStructuredWidget = None self.stacked = QStackedWidget(self) self.setCentralWidget(self.stacked) self.data, self.scheme = data, scheme self.data.add_set_notify(self.change_caption) self.toolbar = QToolBar() self.toolbar.addActions((self.parent().actionSave,self.parent().actionSaveAs,)) self.addToolBar(self.toolbar) self.setUnifiedTitleAndToolBarOnMac(True) self.messageBoxChanged = None self.reallyQuit = False self.change_caption() if "ExcelScheme" in self.scheme.get_meta(): actionExcelExport = QAction("Export to excel", self) self.toolbar.addAction(actionExcelExport) actionExcelExport.triggered.connect(self.excel_export) actionExcelMerge = QAction("Merge from excel", self) actionExcelMerge.triggered.connect(self.excel_import) self.toolbar.addAction(actionExcelMerge) self.tree_widget = DataTreeWidget(self.data, self) dock = QDockWidget(self) dock.setWidget(self.tree_widget) self.addDockWidget(Qt.LeftDockWidgetArea, dock) self.tree_widget.pathChanged.connect(self._open_widget_by_path) self.openWidgetByPath(Path())
def __init__(self, parent=None): QDockWidget.__init__(self, parent) self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.setWidget(QueryWidget()) self.setWindowTitle(tr("ui_query", "QuickOSM - Query")) self.widget().signal_new_query_successful.connect( self.signal_new_query_successful.emit)
def __init__(self, iface): # QGIS self.iface = iface self.settings = MySettings() self.linkRubber = QgsRubberBand(self.iface.mapCanvas()) self.featureHighlight = None # Relation management self.relationManager = QgsProject.instance().relationManager() self.relationManager.changed.connect(self.loadRelations) self.relation = QgsRelation() self.referencingFeature = QgsFeature() self.relationWidgetWrapper = None self.editorContext = QgsAttributeEditorContext() self.editorContext.setVectorLayerTools(self.iface.vectorLayerTools()) # GUI QDockWidget.__init__(self) self.setupUi(self) SettingDialog.__init__(self, MySettings(), False, True) self.drawButton.setChecked(self.settings.value("drawEnabled")) self.relationReferenceWidget.setAllowMapIdentification(True) self.relationReferenceWidget.setEmbedForm(False) self.mapTool = QgsMapToolIdentifyFeature(self.iface.mapCanvas()) self.mapTool.setButton(self.identifyReferencingFeatureButton) # Connect signal/slot self.relationComboBox.currentIndexChanged.connect( self.currentRelationChanged) self.mapTool.featureIdentified.connect(self.setReferencingFeature) # load relations at start self.loadRelations()
def __init__(self, title, parent, childType, area=Qt.LeftDockWidgetArea, allowedAreas=Qt.AllDockWidgetAreas, autoAddDock=True, features=QDockWidget.AllDockWidgetFeatures): """ Constructor. @param title dock title @param parent ancestor widget @param childType callable to produce child widget @param area default dock area @param allowedAreas dock widget allowed areas @param autoAddDock if True, dock widget is added to parent @param features dock widget features """ QDockWidget.__init__(self, title, parent) self.setObjectName(title) self.setAllowedAreas(allowedAreas) self.setFeatures(features) self.setWidget(childType(self)) if autoAddDock: parent.addDockWidget(area, self)
def __init__(self): QDockWidget.__init__(self, "Help") self.setObjectName("HelpDock") widget = QWidget() widget.setStyleSheet("background-color: #ffffe0") layout = QVBoxLayout() widget.setLayout(layout) self.link_widget = QLabel() self.link_widget.setStyleSheet("font-weight: bold") self.link_widget.setMinimumHeight(20) self.help_widget = QLabel(HelpDock.default_help_string) self.help_widget.setWordWrap(True) self.help_widget.setTextFormat(Qt.RichText) self.validation_widget = QLabel("") self.validation_widget.setWordWrap(True) self.validation_widget.setScaledContents(True) self.validation_widget.setAlignment(Qt.AlignHCenter) self.validation_widget.setTextFormat(Qt.RichText) layout.addWidget(self.link_widget) layout.addWidget(self.help_widget) layout.addStretch(1) layout.addWidget(self.validation_widget) self.setWidget(widget) self.help_messages = {} MessageCenter().addHelpMessageListeners(self)
def __init__(self, name, parent=None): QDockWidget.__init__(self, name, parent) # we do not know the initial state yet but will get an event on # visibilityChanged as soon as the windows are first shown self.__visible = None self.visibilityChanged.connect(self.__updateVisibility)
def __init__(self): QMainWindow.__init__(self) self.figure = matplotlib.pyplot.figure() self.drawing = self.figure.add_subplot(111) self.canvas = matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg( self.figure) self.setCentralWidget(self.canvas) dock = QDockWidget("Values") self.addDockWidget(Qt.RightDockWidgetArea, dock) sliders = QWidget() sliders_grid = QGridLayout(sliders) def add_slider(foo, col): sld = QSlider(Qt.Vertical, sliders) sld.setFocusPolicy(Qt.NoFocus) sld.valueChanged[int].connect(foo) sld.valueChanged.connect(self.plot) sliders_grid.addWidget(sld, 0, col) add_slider(foo=self.set_cos, col=0) add_slider(foo=self.set_sin, col=1) dock.setWidget(sliders) self.plot()
def _createDock(self): dock = QDockWidget("Workflow") dock.setObjectName("ERTGUI Workflow") dock.setWidget(self.contentsWidget) dock.setFeatures(QDockWidget.DockWidgetClosable) dock.setAllowedAreas(Qt.LeftDockWidgetArea) return dock
def __init__(self, parent = None): QDockWidget.__init__(self, "File System Tree View", parent) self.setObjectName("FileNavigatorDock") self.fsm = QFileSystemModel(self) tv = QTreeView(self) tv.showColumn(1) self.fsm.setRootPath(self.parent().workdir) tv.setModel(self.fsm) self.setAllowedAreas( self.left | self.right ) self.setGeometry(0,0,400,1000) pb = QPushButton("...",self) pb.clicked.connect(self.changeWorkdir) self.le = QLineEdit(self) self.le.setText(self.parent().workdir) dockbox = QWidget(self) hl = QHBoxLayout(dockbox) hl.addWidget(self.le) hl.addWidget(pb) hll=QWidget(self) hll.setLayout(hl) vl = QVBoxLayout(dockbox) dockbox.setLayout(vl) vl.addWidget(hll) vl.addWidget(tv) self.setWidget(dockbox) self.adjustSize() self.parent().say("Vista del sistema de ficheros creada")
def __init__(self, iface): QDockWidget.__init__(self) self.setupUi(self) self.iface = iface self.canvas = self.iface.mapCanvas() self.geoCrs = QgsCoordinateReferenceSystem(4326) self.btnAddPhoto.setIcon(QIcon(':/icons/camera.svg')) self.txtPhotoComment.setPlaceholderText(self.tr('Comment')) self.cmbLayers.setFilters(QgsMapLayerProxyModel.VectorLayer) self.db = QSqlDatabase.addDatabase('QPSQL') self.landmarkId = None self.photoId = None self.highlight = None self.model = QStandardItemModel() self.lstPhotos.setModel(self.model) self.btnUpdateLandmark.clicked.connect(self.saveLandmark) self.btnDeleteLandmark.clicked.connect(self.deleteLandmark) self.btnAddPhoto.clicked.connect(self.addPhoto) self.btnUpdatePhoto.clicked.connect(self.savePhoto) self.btnDeletePhoto.clicked.connect(self.removePhoto) self.lstPhotos.selectionModel().selectionChanged.connect( self.photoSelected) self.lstPhotos.doubleClicked.connect(self.showPhoto) self._enableOrDisableButtons() self.ToggleToolbox()
def createAboutWidget(self): self.AboutDock = QDockWidget("About", self) self.AboutDock.setObjectName("about") self.AboutDock.setTitleBarWidget(QWidget()) self.AboutDock.setContentsMargins(0, 0, 0, 0) self.tabifyDockWidget(self.LegendDock, self.AboutDock) self.LegendDock.raise_() # legendDock at the top from PyQt4.QtCore import QRect from PyQt4.QtGui import QSizePolicy, QGridLayout, QFont font = QFont() font.setFamily("Sans Serif") font.setPointSize(8.7) self.AboutWidget = QWidget() self.AboutWidget.setFont(font) self.AboutWidget.setObjectName("AboutWidget") self.AboutDock.setWidget(self.AboutWidget) self.labelAbout = QLabel(self.AboutWidget) self.labelAbout.setAlignment(Qt.AlignCenter) self.labelAbout.setWordWrap(True) self.gridLayout = QGridLayout(self.AboutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.gridLayout.addWidget(self.labelAbout, 0, 1, 1, 1) self.labelAbout.setTextInteractionFlags(Qt.LinksAccessibleByMouse | Qt.LinksAccessibleByKeyboard | Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse) self.labelAbout.setOpenExternalLinks(True) self.labelAbout.setText("<html><head/><body><a href=\"http://geotux.tuxfamily.org/index.php/en/geo-blogs/item/293-consola-sql-para-plugin-pgadmin-postgis-viewer\">PostGIS Layer Viewer</a> v.1.6.1 (2015.02.24)<br \><br \>" \ "Copyright (c) 2010 Ivan Mincik,<br \>[email protected]<br \>" \ u"Copyright (c) 2011-2015 Germán Carrillo,<br \>[email protected]<br \><br \>" \ "<i>Licensed under the terms of GNU GPL v.2.0</i><br \><br \>" \ "Based on PyQGIS. Plugin Fast SQL Layer by Pablo T. Carreira.</body></html>" )
def __init__(self): QDockWidget.__init__(self, None) self.setupUi(self) self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.modeComboBox.clear() self.modeComboBox.addItems( ['Simplified interface', 'Advanced interface']) settings = QSettings() if not settings.contains(self.USE_CATEGORIES): settings.setValue(self.USE_CATEGORIES, True) useCategories = settings.value(self.USE_CATEGORIES, type=bool) if useCategories: self.modeComboBox.setCurrentIndex(0) else: self.modeComboBox.setCurrentIndex(1) self.modeComboBox.currentIndexChanged.connect(self.modeHasChanged) self.searchBox.textChanged.connect(self.textChanged) self.algorithmTree.customContextMenuRequested.connect( self.showPopupMenu) self.algorithmTree.doubleClicked.connect(self.executeAlgorithm) if hasattr(self.searchBox, 'setPlaceholderText'): self.searchBox.setPlaceholderText(self.tr('Search...')) self.fillTree()
def __init__(self,iface): self.iface = iface QDockWidget.__init__(self) self.setupUi(self) self.iface.addDockWidget(Qt.BottomDockWidgetArea,self) self.canvas = self.iface.mapCanvas() self.rb = QgsRubberBand(self.canvas, QGis.Point) self.rb.setColor(QColor( 255, 0, 0, 150 )) self.searchCacheLimit = 1000 self.wgs84 = QgsCoordinateReferenceSystem() self.wgs84.createFromSrid(4326) self.proj = self.canvas.mapRenderer().destinationCrs() self.transform = QgsCoordinateTransform(self.wgs84, self.proj) self.bSearch.clicked.connect(self.startSearch) self.eOutput.currentItemChanged.connect(self.itemChanged) self.eOutput.clickedOutsideOfItems.connect(self.itemChanged) self.eText.cleared.connect(self.clearEdit) self.canvas.mapRenderer().destinationSrsChanged.connect(self.crsChanged) self.iface.newProjectCreated.connect(self.clearEdit) self.iface.projectRead.connect(self.clearEdit) self.cbCenter.stateChanged.connect(self.autocenter) db = cacheDB() self.autocompleteList = db.getAutocompleteList() db.closeConnection() self.completer = QCompleter(self.autocompleteList) self.completer.setCaseSensitivity(Qt.CaseInsensitive) self.eText.setCompleter(self.completer)
def __init__(self, parent=None): QDockWidget.__init__(self, parent) self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.setWidget(MyQueriesWidget()) self.setWindowTitle(tr("ui_my_queries", "QuickOSM - My queries")) self.widget().signal_delete_query_successful.connect( self.signal_delete_query_successful.emit)
def insertDockWidgets(self): """ adds the Tree-DockWidget to the GUI <br> this function is connected to the signal SignalProxy::insertDockWidgets() """ dock = QDockWidget(self.name) dock.setObjectName(self.name + "View") dock.setWidget(self.view) self.distributedObjects.signalProxy.emitAddDockWidget(Qt.BottomDockWidgetArea, dock, True)
def __init__(self): QDockWidget.__init__(self, None) self.setupUi(self) self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.modeComboBox.clear() self.modeComboBox.addItems(["Simplified interface", "Advanced interface"]) settings = QSettings() if not settings.contains(self.USE_CATEGORIES): settings.setValue(self.USE_CATEGORIES, True) useCategories = settings.value(self.USE_CATEGORIES, type=bool) if useCategories: self.modeComboBox.setCurrentIndex(0) else: self.modeComboBox.setCurrentIndex(1) self.modeComboBox.currentIndexChanged.connect(self.modeHasChanged) self.searchBox.textChanged.connect(self.textChanged) self.algorithmTree.customContextMenuRequested.connect(self.showPopupMenu) self.algorithmTree.doubleClicked.connect(self.executeAlgorithm) if hasattr(self.searchBox, "setPlaceholderText"): self.searchBox.setPlaceholderText(self.tr("Search...")) self.fillTree()
def __init__(self): QDockWidget.__init__(self, QCoreApplication.translate('DataBrowser', "Data Browser")) self.setFeatures(QDockWidget.DockWidgetClosable | QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetVerticalTitleBar) self.setMinimumSize(350, 500) self.toolBox = QToolBox(self) self.setWidget(self.toolBox)
class Main(plugin.Plugin): " dock Class " def initialize(self): " Init Class dock " self.dock = QDockWidget() self.dock.setFeatures(QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable) self.dock.setWindowTitle(__doc__) self.dock.setStyleSheet('QDockWidget::title{text-align: center;}') self.boton = QPushButton(QIcon.fromTheme("media-eject"), ' Open Media ', self.dock) try: self.factory = KPluginLoader("dragonpart").factory() self.part = self.factory.create(self) self.boton.clicked.connect(lambda: self.part.openUrl(KUrl(str( QFileDialog.getOpenFileName(self.dock, ' Open Media File ', path.expanduser("~"), ';;'.join(['(*.{})'.format(e) for e in ['ogv', 'webm', 'avi', 'mpg', 'mpeg', '3gp', 'wmv', 'mp3', 'asf', 'dat', 'flv', 'flac', 'ogg', 'mkv', 'mov', 'swf', 'wav', 'rm', 'm4v', 'aaf', 'mp4', 'raw', '*']])))))) self.dock.setWidget(self.part.widget()) except: self.dock.setWidget(QLabel(""" <center> <h3>ಠ_ಠ<br> ERROR: Please, install Dragon Player and PyKDE ! </h3><br> <br><i> (Sorry, cant embed non-Qt Apps). </i>><center>""")) self.misc = self.locator.get_service('misc') self.misc.add_widget(self.dock, QIcon.fromTheme("applications-multimedia"), __doc__)
def initGui(self): for keyseq, slot in ( (Qt.CTRL + Qt.ALT + Qt.Key_K, self.__create_group), (Qt.CTRL + Qt.ALT + Qt.Key_S, self.__select_next_group), (Qt.CTRL + Qt.ALT + Qt.Key_N, self.__next_section), (Qt.CTRL + Qt.ALT + Qt.Key_B, self.__previous_section), ): short = QShortcut(QKeySequence(keyseq), self.__iface.mainWindow()) short.setContext(Qt.ApplicationShortcut) short.activated.connect(slot) self.__shortcuts.append(short) self.__menu = QMenu("Albion") self.__menu.aboutToShow.connect(self.__create_menu_entries) self.__iface.mainWindow().menuBar().addMenu(self.__menu) self.__toolbar = QToolBar("Albion") self.__iface.addToolBar(self.__toolbar) self.__toolbar.addAction(icon("log_strati.svg"), "stratigraphic log").triggered.connect( self.__log_strati_clicked) self.__toolbar.addWidget(self.__current_graph) self.__current_graph.currentIndexChanged[unicode].connect( self.__current_graph_changed) self.__toolbar.addWidget(self.__current_section) self.__current_section.currentIndexChanged[unicode].connect( self.__current_section_changed) self.__toolbar.addAction( icon("previous_line.svg"), "previous section (Ctrl+Alt+b)").triggered.connect( self.__previous_section) self.__toolbar.addAction( icon("next_line.svg"), "next section (Ctrl+Alt+n)").triggered.connect(self.__next_section) self.__toolbar.addAction(icon("line_from_selected.svg"), "create temporary section").triggered.connect( self.__section_from_selection) self.__viewer3d = QDockWidget("3D") self.__viewer3d.setWidget(Viewer3d()) self.__iface.addDockWidget(Qt.LeftDockWidgetArea, self.__viewer3d) self.__iface.mainWindow().tabifyDockWidget( self.__iface.mainWindow().findChild(QDockWidget, "Layers"), self.__viewer3d) self.__viewer3d_ctrl = QToolBar("3D controls") self.__viewer3d_ctrl.addWidget(ViewerControls( self.__viewer3d.widget())) self.__iface.addToolBar(self.__viewer3d_ctrl) QgsProject.instance().readProject.connect(self.__qgis__project__loaded) self.__qgis__project__loaded() # case of reload
class Main(plugin.Plugin): " dock Class " def initialize(self): " Init Class dock " self.dock = QDockWidget() self.dock.setFeatures(QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable) self.dock.setWindowTitle(__doc__) self.dock.setStyleSheet('QDockWidget::title{text-align: center;}') self.boton = QPushButton(QIcon.fromTheme("document-open-recent"), 'Edit Track', self.dock) self.boton.setToolTip('Edit iCal: {}'.format(TRACK_FILE)) try: self.factory = KPluginLoader("ktimetrackerpart").factory() self.part = self.factory.create(self) self.part.setReadWrite(True) self.part.closeUrl() self.part.openUrl(KUrl(str(TRACK_FILE))) self.boton.clicked.connect(lambda: call('xdg-open {}'.format(TRACK_FILE), shell=True)) self.dock.setWidget(self.part.widget()) except: self.dock.setWidget(QLabel(""" <center> <h3>ಠ_ಠ<br> ERROR: Please, install kTimeTracker and PyKDE ! </h3><br> <br><i> (Sorry, cant embed non-Qt Apps). </i><center>""")) self.misc = self.locator.get_service('misc') self.misc.add_widget(self.dock, QIcon.fromTheme("user-away"), __doc__)
def create_dockwidget(self): """Add to parent QMainWindow as a dock widget""" # This is not clear yet why the following do not work... # (see Issue #880) ## # Using Qt.Window window flags solves Issue #880 (detached dockwidgets ## # are not painted after restarting Spyder and restoring their hexstate) ## # but it does not work with PyQt <=v4.7 (dockwidgets can't be docked) ## # or non-Windows platforms (lot of warnings are printed out) ## # (so in those cases, we use the default window flags: Qt.Widget): ## flags = Qt.Widget if is_old_pyqt or os.name != 'nt' else Qt.Window dock = QDockWidget(self.get_plugin_title(), self.main) #, flags) dock.setObjectName(self.__class__.__name__ + "_dw") dock.setAllowedAreas(self.ALLOWED_AREAS) dock.setFeatures(self.FEATURES) dock.setWidget(self) self.update_margins() self.connect(dock, SIGNAL('visibilityChanged(bool)'), self.visibility_changed) self.dockwidget = dock short = self.get_option("shortcut", None) if short is not None: shortcut = QShortcut(QKeySequence(short), self.main, self.switch_to_plugin) self.register_shortcut(shortcut, "_", "Switch to %s" % self.CONF_SECTION, default=short) return (dock, self.LOCATION)
def __init__( self, parent, canvas, addDockWidget ): QDockWidget.__init__( self, parent ) self.setupUi( self ) self.setAttribute( Qt.WA_DeleteOnClose ) self.canvas = canvas self.addDockWidget = addDockWidget
def __init__(self, parent, canvas, addDockWidget): QDockWidget.__init__(self, parent) self.setupUi(self) self.setAttribute(Qt.WA_DeleteOnClose) self.canvas = canvas self.addDockWidget = addDockWidget
def __init__(self, mainWindow, dockBrowser, nbr): QDockWidget.__init__(self, mainWindow) self.configure() self.addAction(mainWindow, nbr) self.g_display(mainWindow, dockBrowser) self.initCallback() self.setObjectName("LISTFILES " + str(nbr))
def __init__(self, iface): QDockWidget.__init__(self, iface.mainWindow()) self.setupUi(self) self.iface = iface self.search_threads = None # [] if hasattr(self.txtSearch, 'setPlaceholderText'): self.txtSearch.setPlaceholderText(self.tr("Search string...")) self.delay_timer = QTimer(self) self.delay_timer.setSingleShot(True) self.delay_timer.setInterval(250) self.delay_timer.timeout.connect(self.start_search) self.txtSearch.textChanged.connect(self.delay_timer.start) self.one_process_work = QMutex() # self.wSearchResult = QWidget() # self.lSearchResult = QVBoxLayout(self.wSearchResult) # self.saSearchResult.setWidget(self.wSearchResult) # self.saSearchResult.setWidgetResizable(True) self.add_last_used_services()
def __init__(self, parentObject, windowTitle, windowIcon=QIcon(), shortcut=None): QDockWidget.__init__(self, parentObject) self._showAction = None self.setObjectName(str(self.__class__)) self.setWindowTitle(windowTitle) self.setFeatures(self.features() & (~QDockWidget.DockWidgetFloatable)) if not windowIcon.isNull(): self.setWindowIcon(windowIcon) if shortcut is not None: self.showAction().setShortcut(shortcut) self._titleBar = _TitleBar(self) self.setTitleBarWidget(self._titleBar) if shortcut is not None: toolTip = "Move focus with <b>%s</b>,<br/>close with <b>Esc</b>" % shortcut else: toolTip = "Close with <b>Esc</b>" self._titleBar.setToolTip(toolTip) self._closeShortcut = QShortcut(QKeySequence("Esc"), self) self._closeShortcut.setContext(Qt.WidgetWithChildrenShortcut) self._closeShortcut.activated.connect(self._close)
def __init__(self, settings, parent=None): super(MikiWindow, self).__init__(parent) self.setObjectName("mikiWindow") self.settings = settings self.notePath = settings.notePath ################ Setup core components ################ self.notesTree = MikiTree(self) self.notesTree.setObjectName("notesTree") self.initTree(self.notePath, self.notesTree) self.notesTree.sortItems(0, Qt.AscendingOrder) self.ix = None self.setupWhoosh() self.viewedList = QToolBar(self.tr('Recently Viewed'), self) self.viewedList.setIconSize(QSize(16, 16)) self.viewedList.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.viewedListActions = [] self.noteSplitter = QSplitter(Qt.Horizontal) self.dockIndex = QDockWidget("Index") self.dockSearch = QDockWidget("Search") self.searchEdit = QLineEdit() self.searchView = MikiSearch(self) self.searchTab = QWidget() self.dockToc = QDockWidget("TOC") self.tocTree = TocTree() self.dockAttachment = QDockWidget("Attachment") self.attachmentView = AttachmentView(self) self.notesEdit = MikiEdit(self) self.notesEdit.setObjectName("notesEdit") MikiHighlighter(self.notesEdit) self.notesView = MikiView(self) self.findBar = QToolBar(self.tr('Find'), self) self.findBar.setFixedHeight(30) self.findEdit = QLineEdit(self.findBar) self.checkBox = QCheckBox(self.tr('Match case'), self.findBar) self.statusBar = QStatusBar(self) self.statusLabel = QLabel(self) self.altPressed = False ################ Setup actions ################ self.actions = dict() self.setupActions() ################ Setup mainwindow ################ self.setupMainWindow() # show changelogs after upgrade mikidown if self.settings.version < __version__: self.changelogHelp() self.settings.qsettings.setValue("version", __version__)
def __init__(self, *args): QDockWidget.__init__(self, *args) self.setupUi(self) self.setWindowIcon(QIcon(':/icons/qtsixa.png')) self.color = QColor(Qt.lightGray) self.setMinimumWidth(350) self.setContentsMargins(0, 0, 0, 0) self.adjustSize()
def __init__(self, iface): self.__iface = iface self.__section_main = MainWindow(iface) self.__dock = QDockWidget('Section') self.__dock.setWidget(self.__section_main) self.__legend_dock = QDockWidget('Section Legend') self.__legend_dock.setWidget(self.__section_main.tree_view)
def __init__(self, *args): QDockWidget.__init__(self, *args) self.titleBar = DockWidgetTitleBar(self) self.setTitleBarWidget(self.titleBar) self.mainWidget = None self.entered = False self.pinned = True self.shot = False
def __init__(self, parent, iface): QDockWidget.__init__(self, parent) self.setupUi(self) self.layerComboBox.currentIndexChanged.connect(self.layerChanged) self.stateButton.clicked.connect(self.stateChanged) self.iface = iface self.mapToolAddReach = QgepMapToolAddReach(self.iface, QgepLayerManager.layer('vw_qgep_reach'))
def dock(self, widget, where, title=None): if title: d = QDockWidget(title, self) else: d = QDockWidget(self) d.setWidget(widget) self.addDockWidget(where, d) return d
def __init__(self, parent=None): super(settings_dock, self).__init__(parent) QDockWidget.__init__(self) self.setWindowFlags(Qt.Window) self.setupUi(self) #confusion_dock.kappa.setText('Hello!')
class StackController(QObject): def __init__(self, distributedObjects): QObject.__init__(self) self.distributedObjects = distributedObjects self.editorController = distributedObjects.editorController self.stackModel = StackModel( self, self.distributedObjects.debugController, self.distributedObjects.gdb_connector ) self.stackView = StackView(self) self.stackView.stackView.setModel(self.stackModel) QObject.connect( self.distributedObjects.signalProxy, SIGNAL("inferiorStoppedNormally(PyQt_PyObject)"), self.stackModel.update, ) QObject.connect( self.distributedObjects.signalProxy, SIGNAL("inferiorHasExited(PyQt_PyObject)"), self.stackModel.clear ) QObject.connect(self.distributedObjects.signalProxy, SIGNAL("executableOpened()"), self.stackModel.clear) QObject.connect( self.distributedObjects.signalProxy, SIGNAL("inferiorIsRunning(PyQt_PyObject)"), self.removeStackMarkers ) QObject.connect(self.stackView.showStackTrace, SIGNAL("stateChanged(int)"), self.showStackTraceChanged) QObject.connect(self.distributedObjects.signalProxy, SIGNAL("insertDockWidgets()"), self.insertDockWidgets) def insertDockWidgets(self): self.stackDock = QDockWidget("Stack") self.stackDock.setObjectName("StackView") self.stackDock.setWidget(self.stackView) self.distributedObjects.signalProxy.addDockWidget(Qt.BottomDockWidgetArea, self.stackDock, True) def stackInStackViewActivated(self, index): item = index.internalPointer() self.distributedObjects.gdb_connector.selectStackFrame(item.level) self.distributedObjects.signalProxy.openFile(item.fullname, item.line) # FIXME: make locals view etc change their view too! def insertStackMarkers(self): if self.stackView.showStackTrace.checkState() == Qt.Checked: for entry in self.stackModel.stack: if int(entry.level) != 0 and hasattr(entry, "fullname") and hasattr(entry, "line"): self.editorController.addStackMarker(entry.fullname, entry.line) def removeStackMarkers(self): for entry in self.stackModel.stack: if int(entry.level) != 0 and hasattr(entry, "fullname"): self.editorController.delStackMarkers(entry.fullname) def showStackTraceChanged(self, state): if state == Qt.Checked: self.insertStackMarkers() elif state == Qt.Unchecked: self.removeStackMarkers()
def __init__(self, parent=None): QDockWidget.__init__(self, parent) self.setupUi(self) self.__availableMap = {} self.__model = TelemetryModel() self.__model.modelReset.connect(self.telemetryView.resizeColumnsToContents, Qt.QueuedConnection) self.__model.newIntermediate.connect(self._addIntermediate) self.__model.newLap.connect(self._addLap) self.telemetryView.setModel(self.__model)
def setup_dock(self, widget, name, area): """Helps to setup docks more semantically""" dock = QDockWidget(name, self) dock.setObjectName(name) yield dock self.addDockWidget(area, dock) dock.setWidget(widget)
def keyPressEvent(self, event): """Catch Esc. Not using QShortcut, because dock shall be closed, only if child widgets haven't catched Esc event """ if event.key() == Qt.Key_Escape and \ event.modifiers() == Qt.NoModifier: self._hide() else: QDockWidget.keyPressEvent(self, event)
def __init__(self, mainWindow, childWidget, name): QDockWidget.__init__(self, mainWindow) self.mainwindow = mainWindow self.childWidget = childWidget self.init(childWidget) self.show() self.setObjectName(name) self.visibilityState = True self.setTitleBarWidget(self.initTitleBar())
def __init__(self, parent=None, path=None): QDockWidget.__init__(self, parent) self.name = self.tr("Help") self.setFloating(False) self.setFeatures(QDockWidget.NoDockWidgetFeatures) self.__mainWidget = QSplitter(Qt.Horizontal) self.__uname = QWidget() mainWidgetLayout = QVBoxLayout(self.__uname) mainWidgetLayout.setContentsMargins(0, 0, 0, 0) # create helper + search engine self.__helper = QHelpEngine(path, self) if not self.__helper.setupData() is True: dialog = QMessageBox() msg = QString(self.tr("An error occurred while setting help engine up :\n")) msg += (self.__helper.error() + "\n") msg += self.tr("It might mean that the format of your help file is not correct.\n") msg += self.tr("You can check on-line help at http://wiki.digital-forensic.org") dialog.setText(msg) dialog.setIcon(QMessageBox.Warning) dialog.setWindowTitle(self.tr("Error while loading help")) dialog.exec_() return self.__toc = self.__helper.contentWidget() self.__helpBrowser = HelpBrowser(self.__helper) # build main widget self.__toolbar = QWidget() self.__toolbarLayout = QHBoxLayout(self.__toolbar) home = QPushButton(QIcon(":home.png"), "") previous = QPushButton(QIcon(":previous.png"), "") next = QPushButton(QIcon(":next.png"), "") # building toolbar self.__toolbarLayout.addWidget(home) self.__toolbarLayout.addWidget(previous) self.__toolbarLayout.addWidget(next) self.__toolbarLayout.setContentsMargins(0, 0, 0, 0) mainWidgetLayout.addWidget(self.__toolbar) mainWidgetLayout.addWidget(self.__helpBrowser) self.__mainWidget.insertWidget(0, self.__toc) self.__mainWidget.insertWidget(1, self.__uname) self.__mainWidget.setStretchFactor(1, 1) self.setWidget(self.__mainWidget) #connecting `previous`, `home` and `next` buttons self.connect(next, SIGNAL("clicked(bool)"), self.__helpBrowser.nextPage) self.connect(previous, SIGNAL("clicked(bool)"), self.__helpBrowser.prevPage) self.connect(home, SIGNAL("clicked(bool)"), self.__helpBrowser.goHome) self.connect(self.__helper.contentWidget(), SIGNAL("linkActivated(const QUrl &)"), self.__helpBrowser.setSource)
def __init__(self, name, parent): QDockWidget.__init__(self, name, parent) self.titleBar = DockTitleBar(self) self.setTitleBarWidget(self.titleBar) # we do not know the initial state yet but will get an event on # visibilityChanged as soon as the windows are first shown self.__visible = None self.visibilityChanged.connect(self.__updateVisibility)
def __init__(self, parent=None): QDockWidget.__init__(self, parent) self.ui = Ui_CommandLine() self.ui.setupUi(self) self.ui.cmdHist.setLineWrapMode(QtGui.QTextEdit.WidgetWidth) self.filter = CommandLineWidget.KeyEventFilter(self) self.ui.cmdEntry.installEventFilter(self.filter) self._prevcmd = '' self.filter.keyUp.connect(self.prevCmd)
def addDock(self, name, widget, area=Qt.LeftDockWidgetArea, allowed_areas=Qt.AllDockWidgetAreas): dock_widget = QDockWidget(name) dock_widget.setObjectName("%sDock" % name) dock_widget.setWidget(widget) dock_widget.setAllowedAreas(allowed_areas) dock_widget.setFeatures(QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable) self.addDockWidget(area, dock_widget) return dock_widget
def __init__(self, parent=None): QDockWidget.__init__(self, parent) self.trackList = QListWidget() self.trackList.addItem("juhu") # layout = QVBoxLayout() # layout.addWidget(trackList) self.setWidget(self.trackList)
def __init__(self, *args): QDockWidget.__init__(self, *args) self._showAction = None self._titleBar = _TitleBar( self ) self.setTitleBarWidget( self._titleBar ) self._closeShortcut = QShortcut( QKeySequence( "Esc" ), self ) self._closeShortcut.setContext( Qt.WidgetWithChildrenShortcut ) self._closeShortcut.activated.connect(self._hide)
def __init__(self, iface, spatial_unit_dock): QDockWidget.__init__(self, iface.mainWindow()) self.setupUi(self) self.spatial_unit_dock = spatial_unit_dock self.iface = iface self.edit_btn.setDisabled(True) self.delete_btn.setDisabled(True) LayerSelectionHandler.__init__(self, iface, spatial_unit_dock) self.setBaseSize(300,5000)
def showDocumentation(self): if self._documentation is None: doc = QWebView(self) doc.load(QUrl("doc/html/index.html")) self._documentation = QDockWidget("Documentation", self) self._documentation.setWidget(doc) self._documentation.closeEvent = lambda _: self.hide_documentation( ) self.addDockWidget(Qt.LeftDockWidgetArea, self._documentation)
def __init__(self): QMainWindow.__init__(self) #self.ui=uic.loadUi("mainwindow.ui",self) self.DelayStageDock=QDockWidget("DelayStage",self) self.DelayStageDock.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed) self.DelayStageDock.setWidget(DelayStageWidget(self)) self.DelayStageDock.widget().setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed) self.addDockWidget(Qt.TopDockWidgetArea,self.DelayStageDock) self.DelayStageDock.widget().delaystage.throwMessage.connect(self.getMessage)
def crear_dockwidget(self): self.crear_widget() nombre = "Widget de prueba" self.dockWidget = QDockWidget(nombre) self.dockWidget.setObjectName(nombre) self.dockWidget.setWidget(self._widget_demo) self.iface().removeDockWidget(self.dockWidget) self.iface().mainWindow().addDockWidget(Qt.LeftDockWidgetArea, self.dockWidget) self.dockWidget.show()
def __init__(self, parent, iface, title = ""): QDockWidget.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) self.mainWidget = MirrorMap(self, iface) self.location = Qt.RightDockWidgetArea self.title = title self.setupUi() self.connect(self, SIGNAL("dockLocationChanged(Qt::DockWidgetArea)"), self.setLocation)
def taskManager(self): if self.taskMgrDlg.isVisible(): self.taskMgrDlg.loadTaskClicked() # self.taskMgrDlg.close() # self.apdockwidget.close() else: self.taskMgrDlg.show() self.apdockwidget = QDockWidget("Task Manager", self.iface.mainWindow()) self.apdockwidget.setWindowFlags(Qt.FramelessWindowHint) self.apdockwidget.setWidget(self.taskMgrDlg) self.iface.addDockWidget(Qt.RightDockWidgetArea, self.apdockwidget) self.taskMgrDlg.populate() self.taskFeatures() # rows = self.taskMgrDlg.taskListTable.rowCount() # createdByList=[] # # # for row in range(0,rows): # createdByItems=self.taskMgrDlg.taskListTable.item(row,1) # createdByList.append(createdByItems.text()) # # # createdByList=list(set(createdByList)) # self.taskMgrDlg.createByComboBox.addItems(createdByList) # self.taskMgrDlg.createByComboBox.setCurrentIndex(createdByList.index()) self.menu = QtGui.QMenu() #newTask=self.menu.addAction("New Task",self.newTask,"") newTask = self.menu.addAction("New Task", self.newTaskEvent) loadTask = self.menu.addAction("Load Task", self.loadTaskEvent) cancelTask = self.menu.addAction("Cancel Task", self.cancelTaskEvent) showTaskArea = self.menu.addAction("Show Task Area", self.showTaskAreaEvent) noTask = self.menu.addAction("No Task", self.noTaskEvent) showTaskInfo = self.menu.addAction("Show Task Info", self.showTaskInfoEvent) updateFeature = self.menu.addAction("Update Features", self.updateFeatureEvent) self.taskMgrDlg.taskListTable.addAction(newTask) self.taskMgrDlg.taskListTable.addAction(loadTask) self.taskMgrDlg.taskListTable.addAction(cancelTask) self.taskMgrDlg.taskListTable.addAction(showTaskArea) self.taskMgrDlg.taskListTable.addAction(noTask) self.taskMgrDlg.taskListTable.addAction(showTaskInfo) self.taskMgrDlg.taskListTable.addAction(updateFeature) self.taskMgrDlg.taskListTable.setContextMenuPolicy( QtCore.Qt.CustomContextMenu) self.taskMgrDlg.taskListTable.customContextMenuRequested.connect( self.contextMenuEvent) result = self.taskMgrDlg.exec_() if result: self.taskMgrDlg.populate()
def __init__(self, composerView): QObject.__init__(self, composerView) self._compView = composerView self._stdmTB = self.mainWindow().addToolBar("STDM") self._selectMoveAction = None #Container for custom editor widgets self._widgetMappings = {} #Create dock widget for configuring STDM data source self._stdmDataSourceDock = QDockWidget( QApplication.translate("ComposerWrapper", "STDM Data Source"), self.mainWindow()) self._stdmDataSourceDock.setObjectName("STDMDataSourceDock") self._stdmDataSourceDock.setMinimumWidth(300) self._stdmDataSourceDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetClosable) self.mainWindow().addDockWidget(Qt.RightDockWidgetArea, self._stdmDataSourceDock) dataSourceWidget = ComposerDataSourceSelector() self._stdmDataSourceDock.setWidget(dataSourceWidget) self._stdmDataSourceDock.show() #Create dock widget for configuring STDM item properties self._stdmItemPropDock = QDockWidget( QApplication.translate("ComposerWrapper", "STDM data properties"), self.mainWindow()) self._stdmItemPropDock.setObjectName("STDMItemDock") self._stdmItemPropDock.setMinimumWidth(300) self._stdmItemPropDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetClosable) self.mainWindow().addDockWidget(Qt.RightDockWidgetArea, self._stdmItemPropDock) self._stdmItemPropDock.show() if self.itemDock() != None: self.mainWindow().tabifyDockWidget(self.itemDock(), self._stdmItemPropDock) if self.atlasDock() != None: self.atlasDock().hide() if self.generalDock() != None: self.generalDock().raise_() #Connect signals self.composition().itemRemoved.connect(self._onItemRemoved) dataSourceWidget.cboDataSource.currentIndexChanged[str].connect( self.propagateDataSourceSelection) self.composerView().selectedItemChanged.connect(self._onItemSelected) #Current template document file self._currDocFile = None
def create_library_dock(self): if getattr(self, 'dock', None): self.dock.show() return self.dock = QDockWidget("Library", self) self.dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.library = LibraryTableWidget(self.book) self.dock.setWidget(self.library) self.addDockWidget(Qt.LeftDockWidgetArea, self.dock)
def __init__(self, parent, iface, title=""): QDockWidget.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) self.mainWidget = MirrorMap(self, iface) self.location = Qt.RightDockWidgetArea self.title = title self.setupUi() self.connect(self, SIGNAL("dockLocationChanged(Qt::DockWidgetArea)"), self.setLocation)