本文整理汇总了Python中PyQt5.QtWidgets.QSplitter.setOrientation方法的典型用法代码示例。如果您正苦于以下问题:Python QSplitter.setOrientation方法的具体用法?Python QSplitter.setOrientation怎么用?Python QSplitter.setOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QSplitter
的用法示例。
在下文中一共展示了QSplitter.setOrientation方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
def __init__(self, signalNames):
super(MainWindow, self).__init__()
widget = QWidget()
self.setCentralWidget(widget)
self.consoleView = ConsoleView()
self.signalView = SignalView()
buttonsWidget = QWidget()
scroll = QScrollArea()
scroll.setWidget(self.signalView)
scroll.setWidgetResizable(True)
hboxSignalButtons = QHBoxLayout()
self.signalButtons = self.createSignalButtons(signalNames,
hboxSignalButtons)
buttonsWidget.setLayout(hboxSignalButtons)
splitter = QSplitter(self)
splitter.setOrientation(Qt.Vertical)
splitter.addWidget(scroll)
splitter.addWidget(self.consoleView)
vbox = QVBoxLayout()
vbox.addWidget(buttonsWidget)
vbox.addWidget(splitter)
self.createActions()
self.createMenu()
widget.setLayout(vbox)
self.setWindowTitle("kit")
示例2: NetWorthView
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
class NetWorthView(AccountSheetView):
def _setup(self):
self._setupUi()
self.sheet = self.nwsheet = NetWorthSheet(self.model.bsheet, view=self.treeView)
self.graph = self.nwgraph = Chart(self.model.nwgraph, view=self.graphView)
self.piechart = Chart(self.model.pie, view=self.pieChart)
def _setupUi(self):
self.resize(558, 447)
self.mainLayout = QVBoxLayout(self)
self.mainLayout.setSpacing(0)
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.splitterView = QSplitter()
self.splitterView.setChildrenCollapsible(False)
self.splitterView.setOrientation(Qt.Vertical)
self.subSplitterView = QSplitter()
self.subSplitterView.setChildrenCollapsible(False)
self.treeView = TreeView(self)
self.treeView.setAcceptDrops(True)
self.treeView.setFrameShape(QFrame.NoFrame)
self.treeView.setFrameShadow(QFrame.Plain)
self.treeView.setEditTriggers(QAbstractItemView.EditKeyPressed|QAbstractItemView.SelectedClicked)
self.treeView.setDragEnabled(True)
self.treeView.setDragDropMode(QAbstractItemView.InternalMove)
self.treeView.setUniformRowHeights(True)
self.treeView.setAllColumnsShowFocus(True)
self.treeView.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.treeView.header().setStretchLastSection(False)
self.subSplitterView.addWidget(self.treeView)
self.pieChart = PieChartView(self)
self.pieChart.setMinimumSize(300, 0)
self.subSplitterView.addWidget(self.pieChart)
self.splitterView.addWidget(self.subSplitterView)
self.graphView = LineGraphView(self)
self.graphView.setMinimumSize(0, 200)
self.splitterView.addWidget(self.graphView)
self.splitterView.setStretchFactor(0, 1)
self.splitterView.setStretchFactor(1, 0)
self.subSplitterView.setStretchFactor(0, 1)
self.subSplitterView.setStretchFactor(1, 0)
self.mainLayout.addWidget(self.splitterView)
示例3: splitViewSpace
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
def splitViewSpace(self, viewspace, orientation):
"""Split the given view.
If orientation == Qt.Horizontal, adds a new view to the right.
If orientation == Qt.Vertical, adds a new view to the bottom.
"""
active = viewspace is self.activeViewSpace()
splitter = viewspace.parentWidget()
newspace = ViewSpace(self)
if splitter.count() == 1:
splitter.setOrientation(orientation)
size = splitter.sizes()[0]
splitter.addWidget(newspace)
splitter.setSizes([size / 2, size / 2])
elif splitter.orientation() == orientation:
index = splitter.indexOf(viewspace)
splitter.insertWidget(index + 1, newspace)
else:
index = splitter.indexOf(viewspace)
newsplitter = QSplitter()
newsplitter.setOrientation(orientation)
sizes = splitter.sizes()
splitter.insertWidget(index, newsplitter)
newsplitter.addWidget(viewspace)
splitter.setSizes(sizes)
size = newsplitter.sizes()[0]
newsplitter.addWidget(newspace)
newsplitter.setSizes([size / 2, size / 2])
self._viewSpaces.insert(0, newspace)
newspace.showDocument(viewspace.document())
if active:
newspace.activeView().setFocus()
self.actionCollection.window_close_view.setEnabled(self.canCloseViewSpace())
self.actionCollection.window_close_others.setEnabled(self.canCloseViewSpace())
示例4: ConfigurationWidget
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
#.........这里部分代码省略.........
if displayMode in [ConfigurationWidget.HelpBrowserMode,
ConfigurationWidget.TrayStarterMode,
ConfigurationWidget.HexEditorMode]:
self.configListSearch.hide()
if displayMode not in [ConfigurationWidget.TrayStarterMode,
ConfigurationWidget.HexEditorMode]:
self.__initLexers()
def accept(self):
"""
Public slot to accept the buttonBox accept signal.
"""
if not isMacPlatform():
wdg = self.focusWidget()
if wdg == self.configList:
return
self.accepted.emit()
def __setupUi(self):
"""
Private method to perform the general setup of the configuration
widget.
"""
self.setObjectName("ConfigurationDialog")
self.resize(900, 650)
self.verticalLayout_2 = QVBoxLayout(self)
self.verticalLayout_2.setSpacing(6)
self.verticalLayout_2.setContentsMargins(6, 6, 6, 6)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.configSplitter = QSplitter(self)
self.configSplitter.setOrientation(Qt.Horizontal)
self.configSplitter.setObjectName("configSplitter")
self.configListWidget = QWidget(self.configSplitter)
self.leftVBoxLayout = QVBoxLayout(self.configListWidget)
self.leftVBoxLayout.setContentsMargins(0, 0, 0, 0)
self.leftVBoxLayout.setSpacing(0)
self.leftVBoxLayout.setObjectName("leftVBoxLayout")
self.configListSearch = E5ClearableLineEdit(
self, self.tr("Enter search text..."))
self.configListSearch.setObjectName("configListSearch")
self.leftVBoxLayout.addWidget(self.configListSearch)
self.configList = QTreeWidget()
self.configList.setObjectName("configList")
self.leftVBoxLayout.addWidget(self.configList)
self.configListSearch.textChanged.connect(self.__searchTextChanged)
self.scrollArea = QScrollArea(self.configSplitter)
self.scrollArea.setFrameShape(QFrame.NoFrame)
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.scrollArea.setWidgetResizable(False)
self.scrollArea.setObjectName("scrollArea")
self.configStack = QStackedWidget()
self.configStack.setFrameShape(QFrame.Box)
self.configStack.setFrameShadow(QFrame.Sunken)
self.configStack.setObjectName("configStack")
self.scrollArea.setWidget(self.configStack)
self.emptyPage = QWidget()
self.emptyPage.setGeometry(QRect(0, 0, 372, 591))
self.emptyPage.setObjectName("emptyPage")
示例5: _s_CentralWidget
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
#.........这里部分代码省略.........
return
#Rearrange widgets on Window
self._splitterArea.insertWidget(0, self._splitterMain)
if not event.spontaneous():
self.change_misc_visibility()
if bin(settings.UI_LAYOUT)[-1] == '1':
self.splitter_central_rotate()
if bin(settings.UI_LAYOUT >> 1)[-1] == '1':
self.splitter_misc_rotate()
if bin(settings.UI_LAYOUT >> 2)[-1] == '1':
self.splitter_central_orientation()
qsettings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
#Lists of sizes as list of QVariant- heightList = [QVariant, QVariant]
heightList = list(qsettings.value("window/central/mainSize",
[(self.height() / 3) * 2, self.height() / 3]))
widthList = list(qsettings.value("window/central/areaSize",
[(self.width() / 6) * 5, self.width() / 6]))
self._splitterMainSizes = [int(heightList[0]), int(heightList[1])]
self._splitterAreaSizes = [int(widthList[0]), int(widthList[1])]
#Set the sizes to splitters
#self._splitterMain.setSizes(self._splitterMainSizes)
self._splitterMain.setSizes(self._splitterMainSizes)
self._splitterArea.setSizes(self._splitterAreaSizes)
self.misc.setVisible(
qsettings.value("window/show_misc", False, type=bool))
def change_misc_visibility(self, on_start=False):
if self.misc.isVisible():
self._splitterMainSizes = self._splitterMain.sizes()
self.misc.hide()
widget = self.mainContainer.get_actual_widget()
if widget:
widget.setFocus()
else:
self.misc.show()
self.misc.gain_focus()
def change_main_visibility(self):
if self.mainContainer.isVisible():
self.mainContainer.hide()
else:
self.mainContainer.show()
def change_explorer_visibility(self, force_hide=False):
if self.lateralPanel.isVisible() or force_hide:
self._splitterAreaSizes = self._splitterArea.sizes()
self.lateralPanel.hide()
else:
self.lateralPanel.show()
def splitter_central_rotate(self):
w1, w2 = self._splitterArea.widget(0), self._splitterArea.widget(1)
self._splitterArea.insertWidget(0, w2)
self._splitterArea.insertWidget(1, w1)
self.splitterCentralRotated.emit()
def splitter_central_orientation(self):
if self._splitterArea.orientation() == Qt.Horizontal:
self._splitterArea.setOrientation(Qt.Vertical)
else:
self._splitterArea.setOrientation(Qt.Horizontal)
def splitter_misc_rotate(self):
w1, w2 = self._splitterMain.widget(0), self._splitterMain.widget(1)
self._splitterMain.insertWidget(0, w2)
self._splitterMain.insertWidget(1, w1)
def splitter_misc_orientation(self):
if self._splitterMain.orientation() == Qt.Horizontal:
self._splitterMain.setOrientation(Qt.Vertical)
else:
self._splitterMain.setOrientation(Qt.Horizontal)
def get_area_sizes(self):
if self.lateralPanel.isVisible():
self._splitterAreaSizes = self._splitterArea.sizes()
return self._splitterAreaSizes
def get_main_sizes(self):
if self.misc.isVisible():
self._splitterMainSizes = self._splitterMain.sizes()
return self._splitterMainSizes
def enable_follow_mode_scrollbar(self, val):
if val:
editorWidget = self.mainContainer.get_actual_editor()
maxScroll = editorWidget.verticalScrollBar().maximum()
position = editorWidget.verticalScrollBar().value()
self.scrollBar.setMaximum(maxScroll)
self.scrollBar.setValue(position)
self.scrollBar.setVisible(val)
def move_follow_scrolls(self, val):
widget = self.mainContainer._tabMain.currentWidget()
diff = widget._sidebarWidget.highest_line - val
s1 = self.mainContainer._tabMain.currentWidget().verticalScrollBar()
s2 = self.mainContainer._tabSecondary.\
currentWidget().verticalScrollBar()
s1.setValue(val)
s2.setValue(val + diff)
示例6: Window
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
class Window(QWidget):
session = dict()
def __init__(self, config):
super(Window, self).__init__()
self.config = config
self.base_uri = QUrl.fromLocalFile(os.path.dirname(__file__)).toString()
# initial web view add handle all link and form submitted
self.web_view = QWebView(self)
self.web_view.setPage(WebPage())
self.web_view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
self.web_view.page().linkClicked.connect(self.link_clicked)
# self.web_view.page().urlChanged.connect(self.url_changed)
self.web_view.page().loadFinished.connect(self.load_finished)
self.web_view.page().loadStarted.connect(self.load_started)
self.web_view.page().form_submitted.connect(self.handle_form_submitted)
self.web_view.page().request_reload.connect(self.handle_reload)
# initial template lookup
self.tempalte_lookup = TemplateLookup(
directories=[self.config.settings.get("mako.directories")],
module_directory=self.config.settings.get("mako.module_directory"),
input_encoding="utf-8",
)
# layout attribute
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
# add debug inspector
if self.config.settings.get("debug", False):
self.setup_inspector()
self.splitter = QSplitter(self)
self.splitter.setOrientation(Qt.Vertical)
layout.addWidget(self.splitter)
self.splitter.addWidget(self.web_view)
self.splitter.addWidget(self.web_inspector)
else:
layout.addWidget(self.web_view)
def setup_inspector(self):
"""
This code from http://agateau.com/2012/02/03/pyqtwebkit-experiments-part-2-debugging/
"""
page = self.web_view.page()
page.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
self.web_inspector = QWebInspector(self)
self.web_inspector.setPage(page)
shortcut = QShortcut(self)
shortcut.setKey(Qt.Key_F12)
shortcut.activated.connect(self.toggle_inspector)
self.web_inspector.setVisible(False)
def toggle_inspector(self):
self.web_inspector.setVisible(not self.web_inspector.isVisible())
def handle_form_submitted(self, qurl, elements=dict()):
# print("\n\ngot url: ", qurl)
qqurl = QUrlQuery(qurl)
for key, value in qqurl.queryItems():
elements[key] = value
self.render(qurl.path(), elements)
# do stuff with elements...
# for item in elements.items():
# print ("got: ", item)
def handle_reload(self, qurl):
self.render(qurl.path())
def load_started(self):
""""""
# print("load_started ->: ", self.web_view.url())
def load_finished(self, finished):
""""""
# print("load_finished ->: ", finished)
# if finished:
# self.web_view.setUrl(QUrl('/login'))
# def url_changed(self, qurl):
# ''''''
# print("url_changed ->: ", qurl)
def link_clicked(self, qurl):
# print("link_clicked ->: ", qurl)
qqurl = QUrlQuery(qurl)
elements = {}
# print("got link_clicked url: ", qurl)
for key, value in qqurl.queryItems():
#.........这里部分代码省略.........
示例7: __initUI__
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
def __initUI__(self):
# ---- TAB WIDGET
# download weather data :
splash.showMessage("Initializing download weather data...")
self.tab_dwnld_data = DwnldWeatherWidget(self)
self.tab_dwnld_data.set_workdir(self.projectdir)
# gapfill weather data :
splash.showMessage("Initializing gapfill weather data...")
self.tab_fill_weather_data = GapFillWeatherGUI(self)
self.tab_fill_weather_data.set_workdir(self.projectdir)
# hydrograph :
splash.showMessage("Initializing plot hydrograph...")
self.tab_hydrograph = HydroPrint.HydroprintGUI(self.dmanager)
splash.showMessage("Initializing analyse hydrograph...")
self.tab_hydrocalc = HydroCalc.WLCalc(self.dmanager)
self.tab_hydrocalc.sig_new_mrc.connect(
self.tab_hydrograph.mrc_wl_changed)
self.tab_hydrocalc.rechg_eval_widget.sig_new_gluedf.connect(
self.tab_hydrograph.glue_wl_changed)
# ---- TABS ASSEMBLY
self.tab_widget = TabWidget()
self.tab_widget.addTab(self.tab_dwnld_data, 'Download Weather')
self.tab_widget.addTab(self.tab_fill_weather_data, 'Gapfill Weather')
self.tab_widget.addTab(self.tab_hydrograph, 'Plot Hydrograph')
self.tab_widget.addTab(self.tab_hydrocalc, 'Analyze Hydrograph')
self.tab_widget.setCornerWidget(self.pmanager)
self.tab_widget.currentChanged.connect(self.sync_datamanagers)
# ---- Main Console
splash.showMessage("Initializing main window...")
self.main_console = QTextEdit()
self.main_console.setReadOnly(True)
self.main_console.setLineWrapMode(QTextEdit.NoWrap)
style = 'Regular'
family = StyleDB().fontfamily
size = self.whatPref.fontsize_console
fontSS = ('font-style: %s;'
'font-size: %s;'
'font-family: %s;'
) % (style, size, family)
self.main_console.setStyleSheet("QWidget{%s}" % fontSS)
msg = '<font color=black>Thanks for using %s.</font>' % __appname__
self.write2console(msg)
self.write2console('<font color=black>'
'Please report any bug or wishful feature at'
' [email protected]'
'</font>')
# ---- Signal Piping
issuer = self.tab_dwnld_data
issuer.ConsoleSignal.connect(self.write2console)
issuer = self.tab_fill_weather_data
issuer.ConsoleSignal.connect(self.write2console)
issuer = self.tab_hydrograph
issuer.ConsoleSignal.connect(self.write2console)
# ---- Splitter Widget
splitter = QSplitter(self)
splitter.setOrientation(Qt.Vertical)
splitter.addWidget(self.tab_widget)
splitter.addWidget(self.main_console)
splitter.setCollapsible(0, True)
splitter.setStretchFactor(0, 100)
# Forces initially the main_console to its minimal height:
splitter.setSizes([100, 1])
# ---- Main Grid
main_widget = QWidget()
self.setCentralWidget(main_widget)
mainGrid = QGridLayout(main_widget)
mainGrid.addWidget(splitter, 0, 0)
mainGrid.addWidget(self.tab_fill_weather_data.pbar, 1, 0)
mainGrid.addWidget(self.tab_dwnld_data.pbar, 2, 0)
mainGrid.addWidget(
self.tab_hydrocalc.rechg_eval_widget.progressbar, 3, 0)
示例8: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
def __init__(self, ma):
super(MainWidget, self).__init__()
self.ma = ma
mainLayout = QVBoxLayout()
splitter = QSplitter()
self.local_path_view = LocalPathView()
self.server_path_view = ServerPathView()
splitter.addWidget(self.server_path_view)
splitter.addWidget(self.local_path_view)
splitter.setStretchFactor(0, 1)
splitter.setStretchFactor(1, 1)
self.command_output = QTextEdit()
self.command_output.setReadOnly(True)
splitter_vl = QSplitter()
splitter_vl.setOrientation(Qt.Vertical)
splitter_vl.addWidget(splitter)
splitter_vl.addWidget(self.command_output)
splitter_vl.setStretchFactor(0, 8)
splitter_vl.setStretchFactor(1, 2)
command_line_hl = QHBoxLayout()
fcommand_line_name = QLabel("Command line:")
self.lineEdit = QLineEdit()
extract_button = QPushButton("Extract")
command_line_hl.addWidget(fcommand_line_name)
command_line_hl.addWidget(self.lineEdit)
command_line_hl.addWidget(extract_button)
mainLayout.addWidget(splitter_vl)
mainLayout.addLayout(command_line_hl)
self.setLayout(mainLayout)
self.lineEdit.returnPressed.connect(self.processCommand)
extract_button.clicked.connect(self.extract)
config = {}
try:
with open('config.json', 'r') as f:
config = json.load(f)
except :
pass
# [--version] [[-C] <config>] [-s <index-server>] [-t <tape-server>] [-d <tape-device>] [-o <clientconfigoption>]*
prog_name = sys.argv[0]
parser = argparse.ArgumentParser()
if len(sys.argv) > 1:
if(sys.argv[1] == "-C"):
sys.argv.pop(1)
if (sys.argv[1][0] != '-'):
config['config'] = sys.argv[1]
sys.argv.pop(1)
parser.add_argument("-s", dest='index_server')
parser.add_argument("-t", dest='tape_server')
parser.add_argument("-d", dest='tape_device')
parser.add_argument('args', nargs=argparse.REMAINDER)
parsed = parser.parse_args()
if parsed.index_server:
config['index_server'] = parsed.index_server
if parsed.tape_server:
config['tape_server'] = parsed.tape_server
if parsed.tape_device:
config['tape_device'] = parsed.tape_device
config["args"] = parsed.args
sys.argv = [prog_name]
self.amrecover = AmrecoverWrapper(config)
self.command_output.setPlainText(self.amrecover.getCommandRes())
示例9: PanelContainer
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
class PanelContainer(QWidget):
def __init__(self, panelWin):
super(QWidget, self).__init__()
self.panelWindow = panelWin
self.panelCount = 0
self.mainLayout = QGridLayout(self)
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.splitter = QSplitter(self)
self.containerParent = 0
self.mainLayout.addWidget(self.splitter, 0, 0)
def splitter(self):
return self.splitter
def addPanel(self, panel=None):
if panel:
panel.setParent(self)
panel.setContainer(self)
self.splitter.addWidget(panel)
self.panelCount += 1
self.updatePanelSignals(panel)
else:
panel = self.createPanel()
self.splitter.addWidget(panel)
return panel
def addPanelSplit(self, panel, direction):
panel = PanelWidget(self) if 0 else panel
# Store original size
origSize = panel.size()
# reparent the panel
panel.setParent(self)
panel.setContainer(self)
# set orientation and add the panel
self.splitter.setOrientation(direction)
self.splitter.addWidget(panel)
# add another panel for split
panel = self.createPanel()
self.splitter.addWidget(panel)
sizes = list()
origSize *= 0.5
if direction == Qt.Horizontal:
sizes.append(origSize.width())
sizes.append(origSize.width())
else:
sizes.append(origSize.height())
sizes.append(origSize.height())
self.splitter.setSizes(sizes)
self.panelCount += 1
def addContainer(self, child):
child = PanelContainer(self) if 0 else child
self.splitter.addWidget(child)
child.setParentContainer(self)
def insertContainer(self, child, index):
child = PanelContainer(self) if 0 else child
self.splitter.insertWidget(index, child)
child.setParentContainer(self)
def setParentContainer(self, parent):
self.containerParent = parent
def parentContainer(self):
return self.containerParent
def childContainers(self):
# childContainers = list()
# for index in range(0, self.splitter.count()):
# container = self.splitter.widget(index)
# if container:
# childContainers.append(container)
return self.sortedChildren()
def panels(self):
# panels = list()
# for index in range(0, self.splitter.count()):
# panel = self.splitter.widget(index)
# if panel:
# panels.append(panel)
return self.sortedChildren()
def sortedChildren(self):
return (self.splitter.widget(index) for index in range(self.splitter.count()))
def numberOfPanels(self):
return self.panelCount
def createPanel(self):
panel = PanelWidget(self)
#.........这里部分代码省略.........
示例10: ParamModWgt
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
class ParamModWgt(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
self.main_window = parent
self.buildRequiredTagsGB()
# Widgets
self.newParamBtn = QPushButton("New")
self.deleteParamBtn = QPushButton("Delete")
self.paramSaveAnnotBtn = QPushButton("Save")
buttonWidget = QWidget(self)
self.existingParamsGB = QGroupBox("Existing parameters", self)
self.paramListTblWdg = QTableView()
self.paramListModel = ParameterListModel(parent=self)
self.paramListTblWdg.setSelectionBehavior(QAbstractItemView.SelectRows)
self.paramListTblWdg.setSelectionMode(QAbstractItemView.SingleSelection)
self.paramListTblWdg.setModel(self.paramListModel)
self.paramListTblWdg.setColumnWidth(0, 150)
self.paramListTblWdg.setColumnWidth(1, 350)
self.relationWgt = ParamRelationWgt(parent)
self.newParamsGB = QGroupBox("Parameter details", self)
self.resultTypeCbo = QComboBox(self)
self.isExpProp = QCheckBox("is an experimental property", self)
self.resultTypeCbo.addItems(["point value", "function", "numerical trace"])
self.singleValueParamWgt = ParamValueWgt(parent)
self.functionParamWgt = ParamFunctionWgt(parent)
self.traceParamWgt = ParamTraceWgt(parent)
self.functionParamWgt.mainWgt = self
self.paramModStack = QStackedWidget(self)
self.paramModStack.addWidget(self.singleValueParamWgt)
self.paramModStack.addWidget(self.functionParamWgt)
self.paramModStack.addWidget(self.traceParamWgt)
# Signals
selectionModel = self.paramListTblWdg.selectionModel()
selectionModel.selectionChanged.connect(self.selectedParameterChanged)
self.newParamBtn.clicked.connect(self.newParameter)
self.deleteParamBtn.clicked.connect(self.deleteParameter)
self.paramSaveAnnotBtn.clicked.connect(self.saveParameter)
self.resultTypeCbo.currentIndexChanged.connect(self.paramModStack.setCurrentIndex)
self.singleValueParamWgt.paramTypeSelected.connect(self.newParamTypeSelected)
self.functionParamWgt.paramTypeSelected.connect(self.newParamTypeSelected)
self.traceParamWgt.paramTypeSelected.connect(self.newParamTypeSelected)
# Layout
buttonLayout = QVBoxLayout(buttonWidget)
buttonLayout.addWidget(self.paramSaveAnnotBtn)
buttonLayout.addWidget(self.deleteParamBtn)
buttonLayout.addWidget(self.newParamBtn)
existGrid = QHBoxLayout(self.existingParamsGB)
existGrid.addWidget(buttonWidget)
existGrid.addWidget(self.paramListTblWdg)
newGrid = QGridLayout(self.newParamsGB)
newGrid.addWidget(QLabel("Result type"), 0, 0)
newGrid.addWidget(self.resultTypeCbo, 0, 1)
newGrid.addWidget(self.isExpProp, 0, 2)
newGrid.addWidget(self.paramModStack, 1, 0, 1, 3)
newGrid.addWidget(self.relationWgt, 1, 3)
layout = QVBoxLayout(self)
self.rootLayout = QSplitter(Qt.Vertical, self)
self.rootLayout.setOrientation(Qt.Vertical)
self.rootLayout.addWidget(self.existingParamsGB)
self.rootLayout.addWidget(self.newParamsGB)
self.rootLayout.addWidget(self.requireTagGB)
layout.addWidget(self.rootLayout)
# Initial behavior
self.newParamBtn.setEnabled(True)
self.deleteParamBtn.setEnabled(False)
self.paramSaveAnnotBtn.setEnabled(False)
self.additionMode = False
self.newParamsGB.setEnabled(False)
def setRootLayoutSizes(self, sizes):
self.rootLayout.setSizes(sizes)
def viewParameter(self, parameter):
row = -1
for row, param in enumerate(self.paramListModel.parameterList):
if param.id == parameter.id:
break
assert(row > -1)
self.paramListTblWdg.selectRow(row)
#.........这里部分代码省略.........
示例11: SignalTabController
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
class SignalTabController(QWidget):
frame_closed = pyqtSignal(SignalFrameController)
not_show_again_changed = pyqtSignal()
signal_created = pyqtSignal(Signal)
files_dropped = pyqtSignal(list)
frame_was_dropped = pyqtSignal(int, int)
@property
def num_frames(self):
return self.splitter.count() - 1
@property
def signal_frames(self):
"""
:rtype: list of SignalFrameController
"""
return [self.splitter.widget(i) for i in range(self.num_frames)]
@property
def signal_undo_stack(self):
return self.undo_stack
def __init__(self, project_manager, parent=None):
super().__init__(parent)
self.ui = Ui_Interpretation()
self.ui.setupUi(self)
self.splitter = QSplitter()
self.splitter.setStyleSheet("QSplitter::handle:vertical {\nmargin: 4px 0px; background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, \nstop:0 rgba(255, 255, 255, 0), \nstop:0.5 rgba(100, 100, 100, 100), \nstop:1 rgba(255, 255, 255, 0));\n image: url(:/icons/data/icons/splitter_handle_horizontal.svg);\n}")
self.splitter.setOrientation(Qt.Vertical)
self.splitter.setChildrenCollapsible(True)
self.splitter.setHandleWidth(6)
placeholder_widget = QWidget()
placeholder_widget.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
self.undo_stack = QUndoStack()
self.project_manager = project_manager
self.splitter.addWidget(placeholder_widget)
self.signal_vlay = QVBoxLayout()
self.signal_vlay.setContentsMargins(0,0,0,0)
self.signal_vlay.addWidget(self.splitter)
self.ui.scrlAreaSignals.setLayout(self.signal_vlay)
self.drag_pos = None
def on_files_dropped(self, files):
self.files_dropped.emit(files)
def close_frame(self, frame:SignalFrameController):
self.frame_closed.emit(frame)
def add_signal_frame(self, proto_analyzer):
sig_frame = SignalFrameController(proto_analyzer, self.undo_stack, self.project_manager, parent=self)
sframes = self.signal_frames
if len(proto_analyzer.signal.filename) == 0:
# new signal from "create signal from selection"
sig_frame.ui.btnSaveSignal.show()
self.__create_connects_for_signal_frame(signal_frame=sig_frame)
sig_frame.signal_created.connect(self.signal_created.emit)
sig_frame.not_show_again_changed.connect(self.not_show_again_changed.emit)
sig_frame.ui.lineEditSignalName.setToolTip(self.tr("Sourcefile: ") + proto_analyzer.signal.filename)
sig_frame.apply_to_all_clicked.connect(self.on_apply_to_all_clicked)
prev_signal_frame = sframes[-1] if len(sframes) > 0 else None
if prev_signal_frame is not None and hasattr(prev_signal_frame, "ui"):
sig_frame.ui.cbProtoView.setCurrentIndex(prev_signal_frame.ui.cbProtoView.currentIndex())
sig_frame.blockSignals(True)
if proto_analyzer.signal.qad_demod_file_loaded:
sig_frame.ui.cbSignalView.setCurrentIndex(1)
sig_frame.ui.cbSignalView.setDisabled(True)
self.splitter.insertWidget(self.num_frames, sig_frame)
sig_frame.blockSignals(False)
default_view = constants.SETTINGS.value('default_view', 0, int)
sig_frame.ui.cbProtoView.setCurrentIndex(default_view)
return sig_frame
def __create_connects_for_signal_frame(self, signal_frame: SignalFrameController):
signal_frame.hold_shift = constants.SETTINGS.value('hold_shift_to_drag', False, type=bool)
signal_frame.drag_started.connect(self.frame_dragged)
signal_frame.frame_dropped.connect(self.frame_dropped)
signal_frame.files_dropped.connect(self.on_files_dropped)
signal_frame.closed.connect(self.close_frame)
def add_empty_frame(self, filename: str, proto):
sig_frame = SignalFrameController(proto_analyzer=proto, undo_stack=self.undo_stack,
project_manager=self.project_manager, proto_bits=proto.decoded_proto_bits_str,
parent=self)
sig_frame.ui.lineEditSignalName.setText(filename)
sig_frame.setMinimumHeight(sig_frame.height())
sig_frame.set_empty_frame_visibilities()
#.........这里部分代码省略.........
示例12: EntryView
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
class EntryView(BaseTransactionView):
def _setup(self):
self._setupUi()
self.etable = EntryTable(self.model.etable, view=self.tableView)
self.efbar = EntryFilterBar(model=self.model.filter_bar, view=self.filterBar)
self.bgraph = Chart(self.model.bargraph, view=self.barGraphView)
self.lgraph = Chart(self.model.balgraph, view=self.lineGraphView)
self._setupColumns() # Can only be done after the model has been connected
self.reconciliationButton.clicked.connect(self.model.toggle_reconciliation_mode)
def _setupUi(self):
self.resize(483, 423)
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setSpacing(0)
self.filterBar = RadioBox(self)
sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.filterBar.sizePolicy().hasHeightForWidth())
self.filterBar.setSizePolicy(sizePolicy)
self.horizontalLayout.addWidget(self.filterBar)
self.horizontalLayout.addItem(horizontalSpacer())
self.reconciliationButton = QPushButton(tr("Reconciliation"))
self.reconciliationButton.setCheckable(True)
self.horizontalLayout.addWidget(self.reconciliationButton)
self.verticalLayout.addLayout(self.horizontalLayout)
self.splitterView = QSplitter()
self.splitterView.setOrientation(Qt.Vertical)
self.splitterView.setChildrenCollapsible(False)
self.tableView = TableView(self)
self.tableView.setAcceptDrops(True)
self.tableView.setEditTriggers(QAbstractItemView.DoubleClicked|QAbstractItemView.EditKeyPressed)
self.tableView.setDragEnabled(True)
self.tableView.setDragDropMode(QAbstractItemView.InternalMove)
self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
self.tableView.setSortingEnabled(True)
self.tableView.horizontalHeader().setHighlightSections(False)
self.tableView.horizontalHeader().setMinimumSectionSize(18)
self.tableView.verticalHeader().setVisible(False)
self.tableView.verticalHeader().setDefaultSectionSize(18)
self.splitterView.addWidget(self.tableView)
self.graphView = QStackedWidget(self)
sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.graphView.sizePolicy().hasHeightForWidth())
self.graphView.setSizePolicy(sizePolicy)
self.graphView.setMinimumSize(0, 200)
self.lineGraphView = LineGraphView()
self.graphView.addWidget(self.lineGraphView)
self.barGraphView = BarGraphView()
self.graphView.addWidget(self.barGraphView)
self.splitterView.addWidget(self.graphView)
self.graphView.setCurrentIndex(1)
self.splitterView.setStretchFactor(0, 1)
self.splitterView.setStretchFactor(1, 0)
self.verticalLayout.addWidget(self.splitterView)
def _setupColumns(self):
h = self.tableView.horizontalHeader()
h.setSectionsMovable(True) # column drag & drop reorder
# --- QWidget override
def setFocus(self):
self.etable.view.setFocus()
# --- Public
def fitViewsForPrint(self, viewPrinter):
hidden = self.model.mainwindow.hidden_areas
viewPrinter.fitTable(self.etable)
if PaneArea.BottomGraph not in hidden:
viewPrinter.fit(self.graphView.currentWidget(), 300, 150, expandH=True, expandV=True)
def restoreSubviewsSize(self):
graphHeight = self.model.graph_height_to_restore
if graphHeight:
splitterHeight = self.splitterView.height()
sizes = [splitterHeight-graphHeight, graphHeight]
self.splitterView.setSizes(sizes)
# --- model --> view
def refresh_reconciliation_button(self):
if self.model.can_toggle_reconciliation_mode:
self.reconciliationButton.setEnabled(True)
self.reconciliationButton.setChecked(self.model.reconciliation_mode)
else:
self.reconciliationButton.setEnabled(False)
self.reconciliationButton.setChecked(False)
def show_bar_graph(self):
self.graphView.setCurrentIndex(1)
def show_line_graph(self):
self.graphView.setCurrentIndex(0)
def update_visibility(self):
#.........这里部分代码省略.........
示例13: Listspace
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setOrientation [as 别名]
class Listspace(QSplitter, ViewManager):
"""
Class implementing the listspace viewmanager class.
@signal changeCaption(str) emitted if a change of the caption is necessary
@signal editorChanged(str) emitted when the current editor has changed
@signal editorChangedEd(Editor) emitted when the current editor has changed
@signal lastEditorClosed() emitted after the last editor window was closed
@signal editorOpened(str) emitted after an editor window was opened
@signal editorOpenedEd(Editor) emitted after an editor window was opened
@signal editorClosed(str) emitted just before an editor window gets closed
@signal editorClosedEd(Editor) emitted just before an editor window gets
closed
@signal editorRenamed(str) emitted after an editor was renamed
@signal editorRenamedEd(Editor) emitted after an editor was renamed
@signal editorSaved(str) emitted after an editor window was saved
@signal editorSavedEd(Editor) emitted after an editor window was saved
@signal checkActions(Editor) emitted when some actions should be checked
for their status
@signal cursorChanged(Editor) emitted after the cursor position of the
active window has changed
@signal breakpointToggled(Editor) emitted when a breakpoint is toggled.
@signal bookmarkToggled(Editor) emitted when a bookmark is toggled.
@signal syntaxerrorToggled(Editor) emitted when a syntax error is toggled.
@signal previewStateChanged(bool) emitted to signal a change in the
preview state
@signal editorLanguageChanged(Editor) emitted to signal a change of an
editors language
@signal editorTextChanged(Editor) emitted to signal a change of an
editor's text
@signal editorLineChanged(str,int) emitted to signal a change of an
editor's current line (line is given one based)
"""
changeCaption = pyqtSignal(str)
editorChanged = pyqtSignal(str)
editorChangedEd = pyqtSignal(Editor)
lastEditorClosed = pyqtSignal()
editorOpened = pyqtSignal(str)
editorOpenedEd = pyqtSignal(Editor)
editorClosed = pyqtSignal(str)
editorClosedEd = pyqtSignal(Editor)
editorRenamed = pyqtSignal(str)
editorRenamedEd = pyqtSignal(Editor)
editorSaved = pyqtSignal(str)
editorSavedEd = pyqtSignal(Editor)
checkActions = pyqtSignal(Editor)
cursorChanged = pyqtSignal(Editor)
breakpointToggled = pyqtSignal(Editor)
bookmarkToggled = pyqtSignal(Editor)
syntaxerrorToggled = pyqtSignal(Editor)
previewStateChanged = pyqtSignal(bool)
editorLanguageChanged = pyqtSignal(Editor)
editorTextChanged = pyqtSignal(Editor)
editorLineChanged = pyqtSignal(str, int)
def __init__(self, parent):
"""
Constructor
@param parent parent widget (QWidget)
"""
self.stacks = []
QSplitter.__init__(self, parent)
ViewManager.__init__(self)
self.setChildrenCollapsible(False)
self.viewlist = QListWidget(self)
policy = self.viewlist.sizePolicy()
policy.setHorizontalPolicy(QSizePolicy.Ignored)
self.viewlist.setSizePolicy(policy)
self.addWidget(self.viewlist)
self.viewlist.setContextMenuPolicy(Qt.CustomContextMenu)
self.viewlist.currentRowChanged.connect(self.__showSelectedView)
self.viewlist.customContextMenuRequested.connect(self.__showMenu)
self.stackArea = QSplitter(self)
self.stackArea.setChildrenCollapsible(False)
self.addWidget(self.stackArea)
self.stackArea.setOrientation(Qt.Vertical)
stack = StackedWidget(self.stackArea)
self.stackArea.addWidget(stack)
self.stacks.append(stack)
self.currentStack = stack
stack.currentChanged.connect(self.__currentChanged)
stack.installEventFilter(self)
self.setSizes([int(self.width() * 0.2), int(self.width() * 0.8)])
# 20% for viewlist, 80% for the editors
self.__inRemoveView = False
self.__initMenu()
self.contextMenuEditor = None
self.contextMenuIndex = -1
def __initMenu(self):
"""
Private method to initialize the viewlist context menu.
"""
self.__menu = QMenu(self)
self.__menu.addAction(
#.........这里部分代码省略.........