本文整理汇总了Python中PyQt5.QtWidgets.QDockWidget.setAllowedAreas方法的典型用法代码示例。如果您正苦于以下问题:Python QDockWidget.setAllowedAreas方法的具体用法?Python QDockWidget.setAllowedAreas怎么用?Python QDockWidget.setAllowedAreas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QDockWidget
的用法示例。
在下文中一共展示了QDockWidget.setAllowedAreas方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createTreeView
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def createTreeView(self):
dockWidget = QDockWidget()
dockWidget.setAllowedAreas(Qt.LeftDockWidgetArea)
dockWidget.setFeatures(QDockWidget.NoDockWidgetFeatures)
dockWidget.setTitleBarWidget(QWidget())
self.treeView = QTreeView()
self.treeView.clicked.connect(self.treeItemClicked)
self.treeModel = TreeModel()
self.treeView.setModel(self.treeModel)
self.logo = QLabel()
logoPixmap = QPixmap(CMAKE_INSTALL_PREFIX + '/share/jderobot/resources/jderobot.png')
self.logo.setPixmap(logoPixmap)
self.upButton = QPushButton()
self.upButton.setText('Up')
self.upButton.clicked.connect(self.upButtonClicked)
leftContainer = QWidget()
leftLayout = QVBoxLayout()
leftLayout.addWidget(self.treeView)
leftLayout.addWidget(self.upButton)
leftLayout.addWidget(self.logo)
leftContainer.setLayout(leftLayout)
dockWidget.setWidget(leftContainer)
self.addDockWidget(Qt.LeftDockWidgetArea, dockWidget)
示例2: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def createDockWindows(self):
dock = QDockWidget("Folders", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
#Code to Create FileView Colums and FolderTree
self.FileView = QtWidgets.QColumnView()
self.FileView.setGeometry(QtCore.QRect(240, 10, 291, 281))
self.FolderTree = QtWidgets.QTreeView()
self.FolderTree.setGeometry(QtCore.QRect(10, 10, 221, 281))
FolderTree = self.FolderTree
#FolderTree.hidecolumn(1),... ?? to show only name column
#include FolderTree to a Dock at the left side
dock.setWidget(FolderTree)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
#set the model and rootpath for filling the FolderTree from self.ui
dirmodel = QFileSystemModel()
#set filter to show only folders
dirmodel.setFilter(QDir.NoDotAndDotDot | QDir.AllDirs)
dirmodel.setRootPath(rootpath)
#filemodel and filter for only files on right side
filemodel = QFileSystemModel()
filemodel.setFilter(QDir.NoDotAndDotDot | QDir.Files)
filemodel.setRootPath(rootpath)
FolderView = self.FolderTree
FolderView.setModel(dirmodel)
FolderView.setRootIndex(dirmodel.index(rootpath))
FileView = self.FileView
FileView.setModel(filemodel)
dock = QDockWidget("Files", self)
dock.setWidget(FileView)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
#important lines for the connection, which does not work
self.FolderTree.clicked['QModelIndex'].connect(self.setpathonclick)
示例3: createWidgets
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def createWidgets(self):
"""Cette fonction permet la création de tous les widgets de la
mainWindow"""
#Création toolbar
toolBar = self.addToolBar("Tools")
#Création bar recherche
self.lineEditSearch = QLineEdit()
self.lineEditSearch.setPlaceholderText("Recherche")
self.lineEditSearch.setStyleSheet("background-color:white")
toolBar.addWidget(self.lineEditSearch)
self.lineEditSearch.setMaximumWidth(300)
#Création séparateur
toolBar.addSeparator()
#Création icon add contact
self.actionAdd = QAction("Ajouter (Ctrl+P)",self)
toolBar.addAction(self.actionAdd)
self.actionAdd.setShortcut("Ctrl+P")
self.actionAdd.setIcon(QIcon("Pictures/sign.png"))
#Création icon delete contact
self.actionDelete = QAction("supprimer (Ctrl+D)",self)
toolBar.addAction(self.actionDelete)
self.actionDelete.setShortcut("Ctrl+D")
self.actionDelete.setIcon(QIcon("Pictures/contacts.png"))
#Création icon quit
self.actionQuitter = QAction("Quitter (Ctrl+Q)",self)
toolBar.addAction(self.actionQuitter)
self.actionQuitter.setShortcut("Ctrl+Q")
self.actionQuitter.setIcon(QIcon("Pictures/arrows.png"))
#Création widget central
self.centralWidget = QWidget()
self.centralWidget.setStyleSheet("background-color:white")
self.setCentralWidget(self.centralWidget)
#Création dockWidget left
dockDisplay = QDockWidget("Répertoire")
dockDisplay.setStyleSheet("background-color:white")
dockDisplay.setFeatures(QDockWidget.DockWidgetFloatable)
dockDisplay.setAllowedAreas(Qt.LeftDockWidgetArea |
Qt.RightDockWidgetArea)
self.addDockWidget(Qt.LeftDockWidgetArea,dockDisplay)
containDock = QWidget(dockDisplay)
dockDisplay.setWidget(containDock)
dockLayout = QVBoxLayout()
displayWidget = QScrollArea()
displayWidget.setWidgetResizable(1)
dockLayout.addWidget(displayWidget)
containDock.setLayout(dockLayout)
#Ajouter la list au dockwidget
self.listContact = QListWidget()
displayWidget.setWidget(self.listContact)
示例4: add_view
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def add_view(self, name, widget,parent,first):
dock = QDockWidget(name, self)
dock.setAllowedAreas(Qt.AllDockWidgetAreas)
dock.setWidget(widget)
widget.show()
if first :
self.addDockWidget(Qt.TopDockWidgetArea, dock)
else :
self.tabifyDockWidget(parent,dock)
return dock
示例5: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def createDockWindows(self):
# dock for project files
dock = QDockWidget("Project", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.projectTreeView= TreeView(dock)
dock.setWidget(self.projectTreeView)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
# dock for html preview
dock = QDockWidget("Preview", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.previewView= HtmlView(dock)
dock.setWidget(self.previewView)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
示例6: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def createDockWindows(self):
dock = QDockWidget("Customers", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.customerList = QListWidget(dock)
self.customerList.addItems((
"John Doe, Harmony Enterprises, 12 Lakeside, Ambleton",
"Jane Doe, Memorabilia, 23 Watersedge, Beaton",
"Tammy Shea, Tiblanka, 38 Sea Views, Carlton",
"Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal",
"Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston",
"Sally Hobart, Tiroli Tea, 67 Long River, Fedula"))
dock.setWidget(self.customerList)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Paragraphs", self)
self.paragraphsList = QListWidget(dock)
self.paragraphsList.addItems((
"Thank you for your payment which we have received today.",
"Your order has been dispatched and should be with you within "
"28 days.",
"We have dispatched those items that were in stock. The rest of "
"your order will be dispatched once all the remaining items "
"have arrived at our warehouse. No additional shipping "
"charges will be made.",
"You made a small overpayment (less than $5) which we will keep "
"on account for you, or return at your request.",
"You made a small underpayment (less than $1), but we have sent "
"your order anyway. We'll add this underpayment to your next "
"bill.",
"Unfortunately you did not send enough money. Please remit an "
"additional $. Your order will be dispatched as soon as the "
"complete amount has been received.",
"You made an overpayment (more than $5). Do you wish to buy more "
"items, or should we return the excess to you?"))
dock.setWidget(self.paragraphsList)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.customerList.currentTextChanged.connect(self.insertCustomer)
self.paragraphsList.currentTextChanged.connect(self.addParagraph)
示例7: __init__
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def __init__(self,mainwin):
te = QPlainTextEdit()
hilighter = hilite.Highlighter(te.document())
qd = QDockWidget("Dae:Xgm")
qd.setWidget(te)
qd.setMinimumSize(480,240)
qd.setFeatures(QDockWidget.DockWidgetMovable|QDockWidget.DockWidgetVerticalTitleBar|QDockWidget.DockWidgetFloatable)
qd.setAllowedAreas(Qt.LeftDockWidgetArea)
qdss = "QWidget{background-color: rgb(64,64,128); color: rgb(160,160,192);}"
qdss += "QDockWidget::title {background-color: rgb(32,32,48); color: rgb(255,0,0);}"
qd.setStyleSheet(qdss)
mainwin.addDockWidget(Qt.LeftDockWidgetArea,qd)
if mainwin.prevDockWidget!=None:
mainwin.tabifyDockWidget(mainwin.prevDockWidget,qd)
mainwin.prevDockWidget = qd
self.stdout = ""
self.stderr = ""
def onSubProcStdout():
bytes = self.process.readAllStandardOutput()
self.stdout += str(bytes, encoding='ascii')
te.setPlainText(self.stdout+self.stderr)
def onSubProcStderr():
bytes = self.process.readAllStandardError()
self.stderr += str(bytes, encoding='ascii')
te.setPlainText(self.stdout+self.stderr)
def finished(text):
print( "process done...\n")
self.process = QProcess()
self.process.readyReadStandardError.connect(onSubProcStderr)
self.process.readyReadStandardOutput.connect(onSubProcStdout);
self.process.finished.connect(finished);
self.process.start(cmd)
示例8: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def createDockWindows(self):
dock = QDockWidget("Sensors", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.sensors= Sensors(dock)
dock.setWidget(self.sensors)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Environment", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.environmentList = QListWidget(dock)
self.environmentList.addItems((
"Omnidirectional Sensor Networks",
"Directional Sensor Networks",
"Directional Path Tracking",
"Big Target Coverage"))
dock.setWidget(self.environmentList)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Simulation", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.simulation= Simulation(dock)
dock.setWidget(self.simulation)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Console", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.console= Console(dock)
dock.setWidget(self.console)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.console.applyButton.clicked.connect(self.applyButtonState)
self.console.playButton.clicked.connect(self.playButtonState)
self.console.pauseButton.clicked.connect(self.pauseButtonState)
self.environmentList.currentTextChanged.connect(self.changeEnvironment)
示例9: Window
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
#.........这里部分代码省略.........
self.serial = QSerialPort()
self.serial.setPortName(port)
if self.serial.open(QIODevice.ReadWrite):
self.serial.dataTerminalReady = True
if not self.serial.isDataTerminalReady():
# Using pyserial as a 'hack' to open the port and set DTR
# as QtSerial does not seem to work on some Windows :(
# See issues #281 and #302 for details.
self.serial.close()
pyser = serial.Serial(port) # open serial port w/pyserial
pyser.dtr = True
pyser.close()
self.serial.open(QIODevice.ReadWrite)
self.serial.setBaudRate(115200)
self.serial.readyRead.connect(self.on_serial_read)
else:
raise IOError("Cannot connect to device on port {}".format(port))
def close_serial_link(self):
"""
Close and clean up the currently open serial link.
"""
self.serial.close()
self.serial = None
def add_filesystem(self, home, file_manager):
"""
Adds the file system pane to the application.
"""
self.fs_pane = FileSystemPane(home)
self.fs = QDockWidget(_('Filesystem on micro:bit'))
self.fs.setWidget(self.fs_pane)
self.fs.setFeatures(QDockWidget.DockWidgetMovable)
self.fs.setAllowedAreas(Qt.BottomDockWidgetArea)
self.addDockWidget(Qt.BottomDockWidgetArea, self.fs)
self.fs_pane.setFocus()
file_manager.on_list_files.connect(self.fs_pane.on_ls)
self.fs_pane.list_files.connect(file_manager.ls)
self.fs_pane.microbit_fs.put.connect(file_manager.put)
self.fs_pane.microbit_fs.delete.connect(file_manager.delete)
self.fs_pane.microbit_fs.list_files.connect(file_manager.ls)
self.fs_pane.local_fs.get.connect(file_manager.get)
self.fs_pane.local_fs.list_files.connect(file_manager.ls)
file_manager.on_put_file.connect(self.fs_pane.microbit_fs.on_put)
file_manager.on_delete_file.connect(self.fs_pane.microbit_fs.on_delete)
file_manager.on_get_file.connect(self.fs_pane.local_fs.on_get)
file_manager.on_list_fail.connect(self.fs_pane.on_ls_fail)
file_manager.on_put_fail.connect(self.fs_pane.on_put_fail)
file_manager.on_delete_fail.connect(self.fs_pane.on_delete_fail)
file_manager.on_get_fail.connect(self.fs_pane.on_get_fail)
self.connect_zoom(self.fs_pane)
return self.fs_pane
def add_micropython_repl(self, port, name):
"""
Adds a MicroPython based REPL pane to the application.
"""
if not self.serial:
self.open_serial_link(port)
# Send a Control-C / keyboard interrupt.
self.serial.write(b'\x03')
repl_pane = MicroPythonREPLPane(serial=self.serial, theme=self.theme)
self.data_received.connect(repl_pane.process_bytes)
self.add_repl(repl_pane, name)
def add_micropython_plotter(self, port, name):
示例10: DocumentController
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
class DocumentController():
"""
Connects UI buttons to their corresponding actions in the model.
"""
### INIT METHODS ###
def __init__(self, document):
"""docstring for __init__"""
# initialize variables
self._document = document
print("the doc", self._document)
self._document.setController(self)
self._active_part = None
self._filename = None
self._file_open_path = None # will be set in _readSettings
self._has_no_associated_file = True
self._path_view_instance = None
self._slice_view_instance = None
self._undo_stack = None
self.win = None
self.fileopendialog = None
self.filesavedialog = None
self.settings = QSettings()
self._readSettings()
# call other init methods
self._initWindow()
app().document_controllers.add(self)
def _initWindow(self):
"""docstring for initWindow"""
self.win = DocumentWindow(doc_ctrlr=self)
# self.win.setWindowIcon(app().icon)
app().documentWindowWasCreatedSignal.emit(self._document, self.win)
self._connectWindowSignalsToSelf()
self.win.show()
app().active_document = self
def _initMaya(self):
"""
Initialize Maya-related state. Delete Maya nodes if there
is an old document left over from the same session. Set up
the Maya window.
"""
# There will only be one document
if (app().active_document and app().active_document.win and
not app().active_document.win.close()):
return
del app().active_document
app().active_document = self
import maya.OpenMayaUI as OpenMayaUI
import sip
ptr = OpenMayaUI.MQtUtil.mainWindow()
mayaWin = sip.wrapinstance(int(ptr), QMainWindow)
self.windock = QDockWidget("cadnano")
self.windock.setFeatures(QDockWidget.DockWidgetMovable
| QDockWidget.DockWidgetFloatable)
self.windock.setAllowedAreas(Qt.LeftDockWidgetArea
| Qt.RightDockWidgetArea)
self.windock.setWidget(self.win)
mayaWin.addDockWidget(Qt.DockWidgetArea(Qt.LeftDockWidgetArea),
self.windock)
self.windock.setVisible(True)
def _connectWindowSignalsToSelf(self):
"""This method serves to group all the signal & slot connections
made by DocumentController"""
self.win.action_new.triggered.connect(self.actionNewSlot)
self.win.action_open.triggered.connect(self.actionOpenSlot)
self.win.action_close.triggered.connect(self.actionCloseSlot)
self.win.action_save.triggered.connect(self.actionSaveSlot)
self.win.action_save_as.triggered.connect(self.actionSaveAsSlot)
self.win.action_SVG.triggered.connect(self.actionSVGSlot)
self.win.action_autostaple.triggered.connect(self.actionAutostapleSlot)
self.win.action_export_staples.triggered.connect(self.actionExportStaplesSlot)
self.win.action_preferences.triggered.connect(self.actionPrefsSlot)
self.win.action_modify.triggered.connect(self.actionModifySlot)
self.win.action_new_honeycomb_part.triggered.connect(\
self.actionAddHoneycombPartSlot)
self.win.action_new_square_part.triggered.connect(\
self.actionAddSquarePartSlot)
self.win.closeEvent = self.windowCloseEventHandler
self.win.action_about.triggered.connect(self.actionAboutSlot)
self.win.action_cadnano_website.triggered.connect(self.actionCadnanoWebsiteSlot)
self.win.action_feedback.triggered.connect(self.actionFeedbackSlot)
self.win.action_filter_handle.triggered.connect(self.actionFilterHandleSlot)
self.win.action_filter_endpoint.triggered.connect(self.actionFilterEndpointSlot)
self.win.action_filter_strand.triggered.connect(self.actionFilterStrandSlot)
self.win.action_filter_xover.triggered.connect(self.actionFilterXoverSlot)
self.win.action_filter_scaf.triggered.connect(self.actionFilterScafSlot)
self.win.action_filter_stap.triggered.connect(self.actionFilterStapSlot)
self.win.action_renumber.triggered.connect(self.actionRenumberSlot)
### SLOTS ###
def undoStackCleanChangedSlot(self):
"""The title changes to include [*] on modification."""
self.win.setWindowModified(not self.undoStack().isClean())
self.win.setWindowTitle(self.documentTitle())
#.........这里部分代码省略.........
示例11: create_widgets
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setAllowedAreas [as 别名]
def create_widgets(MAIN):
"""Create all the widgets and dockwidgets. It also creates actions to
toggle views of dockwidgets in dockwidgets.
"""
""" ------ CREATE WIDGETS ------ """
MAIN.labels = Labels(MAIN)
MAIN.channels = Channels(MAIN)
MAIN.notes = Notes(MAIN)
MAIN.overview = Overview(MAIN)
MAIN.spectrum = Spectrum(MAIN)
MAIN.traces = Traces(MAIN)
MAIN.video = Video(MAIN)
MAIN.settings = Settings(MAIN) # depends on all widgets apart from Info
MAIN.info = Info(MAIN) # this has to be the last, it depends on settings
MAIN.setCentralWidget(MAIN.traces)
""" ------ LIST DOCKWIDGETS ------ """
new_docks = [{'name': 'Information',
'widget': MAIN.info,
'main_area': Qt.LeftDockWidgetArea,
'extra_area': Qt.RightDockWidgetArea,
},
{'name': 'Labels',
'widget': MAIN.labels,
'main_area': Qt.RightDockWidgetArea,
'extra_area': Qt.LeftDockWidgetArea,
},
{'name': 'Channels',
'widget': MAIN.channels,
'main_area': Qt.RightDockWidgetArea,
'extra_area': Qt.LeftDockWidgetArea,
},
{'name': 'Spectrum',
'widget': MAIN.spectrum,
'main_area': Qt.RightDockWidgetArea,
'extra_area': Qt.LeftDockWidgetArea,
},
{'name': 'Annotations',
'widget': MAIN.notes,
'main_area': Qt.LeftDockWidgetArea,
'extra_area': Qt.RightDockWidgetArea,
},
{'name': 'Video',
'widget': MAIN.video,
'main_area': Qt.LeftDockWidgetArea,
'extra_area': Qt.RightDockWidgetArea,
},
{'name': 'Overview',
'widget': MAIN.overview,
'main_area': Qt.BottomDockWidgetArea,
'extra_area': Qt.TopDockWidgetArea,
},
]
""" ------ CREATE DOCKWIDGETS ------ """
idx_docks = {}
actions = MAIN.action
actions['dockwidgets'] = []
for dock in new_docks:
dockwidget = QDockWidget(dock['name'], MAIN)
dockwidget.setWidget(dock['widget'])
dockwidget.setAllowedAreas(dock['main_area'] | dock['extra_area'])
dockwidget.setObjectName(dock['name']) # savestate
idx_docks[dock['name']] = dockwidget
MAIN.addDockWidget(dock['main_area'], dockwidget)
dockwidget_action = dockwidget.toggleViewAction()
dockwidget_action.setIcon(QIcon(ICON['widget']))
actions['dockwidgets'].append(dockwidget_action)
""" ------ ORGANIZE DOCKWIDGETS ------ """
MAIN.tabifyDockWidget(idx_docks['Information'],
idx_docks['Video'])
MAIN.tabifyDockWidget(idx_docks['Channels'],
idx_docks['Labels'])
idx_docks['Information'].raise_()