本文整理汇总了Python中PyQt4.QtGui.QGroupBox.hide方法的典型用法代码示例。如果您正苦于以下问题:Python QGroupBox.hide方法的具体用法?Python QGroupBox.hide怎么用?Python QGroupBox.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGroupBox
的用法示例。
在下文中一共展示了QGroupBox.hide方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Mplayer
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import hide [as 别名]
#.........这里部分代码省略.........
# Chemin sur lequel peut s'ouvrir la boite de dialogue de fichier
# associée au bouton parcourir
self.cheminPourBoutonParcourir = cheminParcourir
self.taille = taille
debug("self.taille avant lecture : %s %s" % (self.taille, type(self.taille)))
#=== Widgets ===#
self.icone_lire=QIcon("Icones" + os.sep + "player_play.png")
self.icone_pause=QIcon("Icones" + os.sep + "player_pause.png")
self.icone_arret=QIcon("Icones" + os.sep + "player_stop.png")
if Mplayer.REVENIR in choixWidget:
self.bout_revenir = QPushButton(u"Revenir")
self.bout_revenir.setIcon(QIcon("Icones" + os.sep + "revenir.png"))
if Mplayer.PARCOURIR in choixWidget:
self.bout_ouvVideo = QPushButton(u"Parcourir...")
if Mplayer.PRECEDENT_SUIVANT in choixWidget:
self.bout_prec = QPushButton(QIcon("Icones" + os.sep + "player_rew.png"),"")
self.bout_prec.setIconSize(QSize(iconTaille, iconTaille))
self.bout_prec.setFlat(flat)
self.bout_suivant = QPushButton(QIcon("Icones" + os.sep + "player_fwd.png"),"")
self.bout_suivant.setIconSize(QSize(iconTaille, iconTaille))
self.bout_suivant.setFlat(flat)
self.LISTW=False
if Mplayer.LIST in choixWidget :
self.LISTW = True
self.listFichiers = QComboBox()
self.listFichiers.hide()
self.setListeVideo()
self.bout_LectPause = QPushButton(self.icone_lire,"")
self.bout_LectPause.setIconSize(QSize(iconTaille, iconTaille))
self.bout_LectPause.setFlat(flat)
self.bout_Arret = QPushButton(self.icone_arret,"")
self.bout_Arret.setIconSize(QSize(iconTaille, iconTaille))
self.bout_Arret.setFlat(flat)
# widget qui contiendra la vidéo
self.cibleVideo = DisplayVid(self)
# par défaut le widget-cible est noir
color = QColor(0, 0, 0)
self.cibleVideo.setAutoFillBackground(True)
self.cibleVideo.setPalette(QPalette(color))
self.cibleVideo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.cibleVideo.setFixedHeight(self.taille[1])
self.cibleVideo.setToolTip(self.fichierCourant[0])
#Choix de l'aspect ratio de la vidéo
if Mplayer.RATIO in choixWidget :
self.conf = QGroupBox()
self.conf.setContentsMargins(0,0,0,0)
self.conf.setMinimumSize(QSize(self.tailleLargeur, 0))
self.conf.setObjectName("conf")
self.verticalLayout = QHBoxLayout(self.conf)
self.verticalLayout.setObjectName("verticalLayout")
self.choicenorm = QRadioButton(self.conf)
self.choicenorm.setObjectName("choicenorm")
self.verticalLayout.addWidget(self.choicenorm)
示例2: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import hide [as 别名]
class Main(plugin.Plugin):
' main class for plugin '
def initialize(self, *args, **kwargs):
' class init '
super(Main, self).initialize(*args, **kwargs)
self.group0 = QGroupBox()
self.group0.setTitle(' Options ')
self.group0.setCheckable(True)
self.group0.toggled.connect(lambda: self.group0.hide())
self.spin1, self.spin2, self.spin3 = QSpinBox(), QSpinBox(), QSpinBox()
self.spin4, self.spin5, self.spin6 = QSpinBox(), QSpinBox(), QSpinBox()
self.spin7, self.spin8, self.spin9 = QSpinBox(), QSpinBox(), QSpinBox()
self.spin10, self.output = QSpinBox(), QTextEdit()
self.reset = QPushButton(QIcon.fromTheme("face-smile"), 'Reset Options')
self.reset.clicked.connect(self.reset_options)
self.reset_options()
self.output.setReadOnly(True)
vboxg3 = QVBoxLayout(self.group0)
for each_widget in (QLabel('<b>Max Attributes Per Class:'), self.spin1,
QLabel('<b>Max Methods Per Class:'), self.spin2,
QLabel('<b>Max Functions Per File:'), self.spin3,
QLabel('<b>Max Classes Per File:'), self.spin4,
QLabel('<b>Max Parameters Per Function:'), self.spin5,
QLabel('<b>Max Lines Per Function:'), self.spin6,
QLabel('<b>Max ControlStatements Per Function:'), self.spin7,
QLabel('<b>Max Lines Per File:'), self.spin8,
QLabel('<b>Max Indentation Levels:'), self.spin9,
QLabel('<b>Max Tabs:'), self.spin10, self.reset):
vboxg3.addWidget(each_widget)
self.group1, self.auto = QGroupBox(), QComboBox()
self.group1.setTitle(' Automation ')
self.group1.setCheckable(True)
self.group1.setToolTip('<font color="red"><b>WARNING:Advanced Setting!')
self.group1.toggled.connect(lambda: self.group1.hide())
self.auto.addItems(['Never run automatically', 'Run when File Saved',
'Run when File Executed', 'Run when Tab Changed',
'Run when File Opened', 'Run before File Saved'])
self.auto.currentIndexChanged.connect(self.on_auto_changed)
QVBoxLayout(self.group1).addWidget(self.auto)
self.button = QPushButton(' Analyze for Best Practice ')
self.button.setMinimumSize(75, 50)
self.button.clicked.connect(self.run)
glow = QGraphicsDropShadowEffect(self)
glow.setOffset(0)
glow.setBlurRadius(99)
glow.setColor(QColor(99, 255, 255))
self.button.setGraphicsEffect(glow)
class TransientWidget(QWidget):
' persistant widget thingy '
def __init__(self, widget_list):
' init sub class '
super(TransientWidget, self).__init__()
vbox = QVBoxLayout(self)
for each_widget in widget_list:
vbox.addWidget(each_widget)
tw = TransientWidget((QLabel('<i>Best Practice analyzer'),
self.group0, self.group1, QLabel('<b>Best Practice Errors:'),
self.output, self.button))
self.scrollable, self.dock = QScrollArea(), QDockWidget()
self.scrollable.setWidgetResizable(True)
self.scrollable.setWidget(tw)
self.dock.setWindowTitle(__doc__)
self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
self.dock.setWidget(self.scrollable)
ExplorerContainer().addTab(self.dock, "Check")
QPushButton(QIcon.fromTheme("help-about"), 'About', self.dock
).clicked.connect(lambda:
QMessageBox.information(self.dock, __doc__, HELPMSG))
def run(self):
' run the actions '
global MAXVAL
self.output.clear()
self.button.setDisabled(True)
maxvalues = {'maxAttributesPerClass': int(self.spin1.value()),
'maxFunctionsPerClass': int(self.spin2.value()),
'maxFunctionsPerFile': int(self.spin3.value()),
'maxClassesPerFile': int(self.spin4.value()),
'maxParametersPerFunction': int(self.spin5.value()),
'maxLinesPerFunction': int(self.spin6.value()),
'maxControlStatementsPerFunction': int(self.spin7.value()),
'maxLinesPerFile': int(self.spin8.value()),
'maxIndentationLevel': int(self.spin9.value()),
'maxTabs': int(self.spin10.value())}
MAXVAL = maxvalues
self.output.append(SimplePythonChecker().analyze(str(
self.locator.get_service("editor").get_opened_documents()[
self.locator.get_service("editor").get_tab_manager().currentIndex()
]), maxvalues))
self.output.setFocus()
self.button.setEnabled(True)
def on_auto_changed(self):
' automation connects '
if self.auto.currentIndex() is 1:
self.locator.get_service('editor').fileSaved.connect(lambda:
#.........这里部分代码省略.........
示例3: AdvancedVisualizationForm
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import hide [as 别名]
class AdvancedVisualizationForm(QWidget):
def __init__(self, mainwindow, result_manager):
QWidget.__init__(self, mainwindow)
#mainwindow is an OpusGui
self.mainwindow = mainwindow
self.result_manager = result_manager
self.toolboxBase = self.result_manager.mainwindow.toolboxBase
self.inGui = False
self.logFileKey = 0
self.xml_helper = ResultsManagerXMLHelper(toolboxBase = self.toolboxBase)
self.result_generator = OpusResultGenerator(
toolboxBase = self.toolboxBase)
self.result_generator.guiElement = self
self.tabIcon = QIcon(':/Images/Images/cog.png')
self.tabLabel = 'Advanced Visualization'
self.widgetLayout = QVBoxLayout(self)
self.widgetLayout.setAlignment(Qt.AlignTop)
self.resultsGroupBox = QGroupBox(self)
self.widgetLayout.addWidget(self.resultsGroupBox)
self.dataGroupBox = QGroupBox(self)
self.widgetLayout.addWidget(self.dataGroupBox)
self.optionsGroupBox = QGroupBox(self)
self.widgetLayout.addWidget(self.optionsGroupBox)
self._setup_definition_widget()
self._setup_buttons()
self._setup_tabs()
def _setup_buttons(self):
# Add Generate button...
self.pbn_go = QPushButton(self.resultsGroupBox)
self.pbn_go.setObjectName('pbn_go')
self.pbn_go.setText(QString('Go!'))
QObject.connect(self.pbn_go, SIGNAL('released()'),
self.on_pbn_go_released)
self.widgetLayout.addWidget(self.pbn_go)
self.pbn_set_esri_storage_location = QPushButton(self.optionsGroupBox)
self.pbn_set_esri_storage_location.setObjectName('pbn_set_esri_storage_location')
self.pbn_set_esri_storage_location.setText(QString('...'))
self.pbn_set_esri_storage_location.hide()
QObject.connect(self.pbn_set_esri_storage_location, SIGNAL('released()'),
self.on_pbn_set_esri_storage_location_released)
def _setup_tabs(self):
# Add a tab widget and layer in a tree view and log panel
self.tabWidget = QTabWidget(self.resultsGroupBox)
# Log panel
self.logText = QTextEdit(self.resultsGroupBox)
self.logText.setReadOnly(True)
self.logText.setLineWidth(0)
self.tabWidget.addTab(self.logText,'Log')
# Finally add the tab to the model page
self.widgetLayout.addWidget(self.tabWidget)
#
def _setup_definition_widget(self):
#### setup results group box ####
self.gridlayout = QGridLayout(self.resultsGroupBox)
self.gridlayout.setObjectName('gridlayout')
self.lbl_results = QLabel(self.resultsGroupBox)
self.lbl_results.setObjectName('lbl_results')
self.lbl_results.setText(QString('Results'))
self.gridlayout.addWidget(self.lbl_results,0,0,1,3)
self._setup_co_results()
self.gridlayout.addWidget(self.co_results,0,3,1,10)
self.pbn_add = QPushButton(self.resultsGroupBox)
self.pbn_add.setObjectName('pbn_add')
self.pbn_add.setText(QString('+'))
QObject.connect(self.pbn_add, SIGNAL('released()'),
self.on_pbn_add_released)
self.gridlayout.addWidget(self.pbn_add, 0, 14, 1, 1)
self.lw_indicators = QListWidget(self.resultsGroupBox)
self.lw_indicators.setObjectName('lw_indicators')
self.gridlayout.addWidget(self.lw_indicators,1,1,1,13)
self.pbn_remove = QPushButton(self.resultsGroupBox)
self.pbn_remove.setObjectName('pbn_remove')
self.pbn_remove.setText(QString('-'))
#.........这里部分代码省略.........
示例4: PluginWidget
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import hide [as 别名]
class PluginWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.pluginMetadata = {}
# Main layout
self.mainLayout = QVBoxLayout()
self.setLayout(self.mainLayout)
# Define size used for the underlines
self.underlineSize = QSize()
self.underlineSize.setHeight(1)
# Define font used for headers
self.font = QFont()
self.font.setPointSize(11)
self.font.setBold(True)
self.font.setUnderline(True)
# Plugins Description
self.pluginDescription = QLabel()
self.pluginDescription.setText("Click a plugin to see more information." +
" Plugins can be configured from the Recording tab. \n")
self.pluginDescription.setWordWrap(True)
# Plugins GroupBox
self.pluginLayout = QVBoxLayout()
self.pluginGroupBox = QGroupBox("Plugins extend the functionality of Freeseer")
self.pluginGroupBox.setLayout(self.pluginLayout)
self.pluginLayout.insertWidget(0, self.pluginDescription)
self.mainLayout.insertWidget(0, self.pluginGroupBox)
# Plugins list
self.list = QTreeWidget()
self.list.setHeaderHidden(True)
self.list.headerItem().setText(0, "1")
self.pluginLayout.insertWidget(1, self.list)
# Details
self.detailPane = QGroupBox()
self.detailLayout = QVBoxLayout()
self.detailPane.setLayout(self.detailLayout)
self.detailPaneDesc = QLabel()
self.detailPaneDesc.setWordWrap(True)
self.detailLayout.addWidget(self.detailPaneDesc)
self.pluginLayout.insertWidget(2, self.detailPane)
self.list.itemSelectionChanged.connect(self.treeViewSelect)
def treeViewSelect(self):
item = self.list.currentItem()
key = str(item.text(0))
if key in self.pluginMetadata.keys():
self.showDetails(key)
else:
self.hideDetails()
def showDetails(self, key):
self.detailPane.setTitle(key)
self.detailPaneDesc.setText(self.pluginMetadata[key])
self.detailPane.show()
def hideDetails(self):
self.detailPane.hide()
def getWidgetPlugin(self, plugin, plugin_category, plugman):
plugin_name = plugin.plugin_object.get_name()
item = QTreeWidgetItem()
# Display Plugin's meta data in a tooltip
pluginDetails = """
<table>
<tr>
<td>Name: </td>
<td><b>%(name)s</b></td>
</tr>
<tr>
<td>Version: </td>
<td><b>%(version)s</b></td>
<tr>
<td>Author: </td>
<td><b>%(author)s</b></td>
</tr>
<tr>
<td>Website: </td>
<td><b>%(website)s</b></td>
</tr>
<tr>
<td>Description: </td>
<td><b>%(description)s</b></td>
</tr>
</table>
""" % {"name": plugin.name,
"version": plugin.version,
"author": plugin.author,
"website": plugin.website,
"description": plugin.description}
#.........这里部分代码省略.........
示例5: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import hide [as 别名]
class Main(plugin.Plugin):
' main class for plugin '
def initialize(self, *args, **kwargs):
' class init '
super(Main, self).initialize(*args, **kwargs)
self.process = QProcess()
self.process.readyReadStandardOutput.connect(self.readOutput)
self.process.readyReadStandardError.connect(self.readErrors)
self.process.finished.connect(self._process_finished)
self.process.error.connect(self._process_finished)
# directory auto completer
self.completer, self.dirs = QCompleter(self), QDirModel(self)
self.dirs.setFilter(QDir.Dirs | QDir.NoDotAndDotDot)
self.completer.setModel(self.dirs)
self.completer.setCaseSensitivity(Qt.CaseInsensitive)
self.completer.setCompletionMode(QCompleter.PopupCompletion)
menu = QMenu('Clones')
menu.addAction('Analyze for Code Clones here', lambda: self.make_clon())
self.locator.get_service('explorer').add_project_menu(menu, lang='all')
self.group1 = QGroupBox()
self.group1.setTitle(' Target ')
self.outdir, self.igndir = QLineEdit(path.expanduser("~")), QLineEdit()
self.outdir.setCompleter(self.completer)
self.btn1 = QPushButton(QIcon.fromTheme("document-open"), ' Open ')
self.btn1.clicked.connect(lambda: self.outdir.setText(str(
QFileDialog.getExistingDirectory(self.dock,
'Please, Open a Target Directory...', path.expanduser("~")))))
self.btn1a = QPushButton(QIcon.fromTheme("face-smile"),
'Get from Ninja active project')
self.btn1a.clicked.connect(lambda: self.outdir.setText(
self.locator.get_service('explorer').get_current_project_item().path))
self.ignckb, self.ignmor = QComboBox(), QTextEdit()
self.ignckb.addItems(['Single Directory', 'Multiple Directories CSV'])
self.ignckb.currentIndexChanged.connect(self.on_ignore_changed)
self.ignmor.hide()
self.igndir.setPlaceholderText('Exclude directory')
self.igndir.setCompleter(self.completer)
self.btn2 = QPushButton(QIcon.fromTheme("document-open"), ' Open ')
self.btn2.clicked.connect(lambda: self.igndir.setText(str(
QFileDialog.getExistingDirectory(self.dock,
'Please, Open a Ignore Directory...', path.expanduser("~")))))
vboxg1 = QVBoxLayout(self.group1)
for each_widget in (QLabel('<b>Target directory path: '), self.outdir,
self.btn1, self.btn1a, QLabel('<b>Ignore directory path: '),
self.ignckb, self.ignmor, self.igndir, self.btn2, ):
vboxg1.addWidget(each_widget)
self.group2 = QGroupBox()
self.group2.setTitle(' Output ')
self.outfle = QLineEdit(path.join(path.expanduser("~"), 'output.html'))
self.outfle.setPlaceholderText('Exclude directory')
self.outfle.setCompleter(self.completer)
self.btn3 = QPushButton(QIcon.fromTheme("document-save"), ' Save ')
self.btn3.clicked.connect(lambda: self.outfle.setText(
QFileDialog.getSaveFileName(self.dock, 'Save', path.expanduser("~"),
'XML(*.xml)' if self.xmlo.isChecked() is True else 'HTML(*.html)')))
vboxg2 = QVBoxLayout(self.group2)
for each_widget in (QLabel('<b>Output report file path:'),
self.outfle, self.btn3):
vboxg2.addWidget(each_widget)
self.group3 = QGroupBox()
self.group3.setTitle(' Options ')
self.group3.setCheckable(True)
self.group3.setGraphicsEffect(QGraphicsBlurEffect(self))
self.group3.graphicsEffect().setEnabled(False)
self.group3.toggled.connect(self.toggle_options_group)
self.qckb1, self.qckb2 = QCheckBox('Recursive'), QCheckBox('Time-less')
self.qckb3, self.qckb4 = QCheckBox('Force Diff'), QCheckBox('Fast Mode')
self.qckb5, self.tm = QCheckBox('Save a LOG file to target'), QLabel('')
self.xmlo = QCheckBox('XML Output instead of HTML')
self.opeo = QCheckBox('Open Clones Report when done')
self.chrt = QCheckBox('LOW CPU priority for Backend Process')
self.mdist, self.hdep, self.output = QSpinBox(), QSpinBox(), QTextEdit()
self.ign_func = QLineEdit('test, forward, backward, Migration')
self.mdist.setValue(5)
self.hdep.setValue(1)
self.mdist.setToolTip('''<b>Maximum amount of difference between pair of
sequences in clone pair (5 default).Larger value more false positive''')
self.hdep.setToolTip('''<b>Computation can be speeded up by increasing
this value, but some clones can be missed (1 default)''')
[a.setChecked(True) for a in (self.qckb1, self.qckb3, self.qckb5,
self.chrt, self.opeo)]
vboxg3 = QVBoxLayout(self.group3)
for each_widget in (self.qckb1, self.qckb2, self.qckb3, self.qckb4,
self.qckb5, self.chrt, self.xmlo, self.opeo,
QLabel('<b>Max Distance Threshold:'), self.mdist,
QLabel('<b>Max Hashing Depth:'), self.hdep,
QLabel('<b>Ignore code block prefix:'), self.ign_func):
vboxg3.addWidget(each_widget)
self.group4, self.auto = QGroupBox(), QComboBox()
self.group4.setTitle(' Automation ')
self.group4.setCheckable(True)
self.group4.setToolTip('<font color="red"><b>WARNING:Advanced Setting!')
self.group4.toggled.connect(lambda: self.group4.hide())
self.auto.addItems(['Never run automatically', 'Run when File Saved',
#.........这里部分代码省略.........
示例6: _init_layout
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import hide [as 别名]
def _init_layout(self):
"""
Create the GUI widgets (but leave them empty).
"""
hostname_combobox = QComboBox(parent=self)
self._hostname_combobox = hostname_combobox
hostname_combobox.setEditable(True)
hostname_combobox.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Maximum )
for hostname in self._suggested_hostnames:
hostname_combobox.addItem( hostname )
# EventFilter is installed after everything else is initialized. (See below.)
#hostname_combobox.installEventFilter(self)
self._connect_button = QPushButton("Connect", parent=self, clicked=self._handle_new_hostname)
hostname_layout = QHBoxLayout()
hostname_layout.addWidget( hostname_combobox )
hostname_layout.addWidget( self._connect_button )
hostinfo_table = QTableWidget()
hostinfo_table.setColumnCount(len(SERVER_INFO_FIELDS))
hostinfo_table.setHorizontalHeaderLabels(SERVER_INFO_FIELDS)
hostinfo_table.horizontalHeader().setVisible(True)
hostinfo_table.verticalHeader().setVisible(False)
hostinfo_table.setRowCount(1)
hostinfo_table.setItem(0,0, QTableWidgetItem("Placeholder"))
hostinfo_table.setVisible(False)
hostinfo_table.resizeRowsToContents()
hostinfo_table.horizontalHeader().setStretchLastSection(True)
table_height = hostinfo_table.verticalHeader().sectionSize(0) + hostinfo_table.rowHeight(0)
hostinfo_table.resize( QSize( hostinfo_table.width(), table_height ) )
hostinfo_table.setMaximumSize( QSize( 1000, table_height ) )
hostinfo_table.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
host_layout = QVBoxLayout()
host_layout.addLayout(hostname_layout)
host_layout.addWidget(hostinfo_table)
host_groupbox = QGroupBox("DVID Host", parent=self)
host_groupbox.setLayout( host_layout )
host_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
repo_treewidget = QTreeWidget(parent=self)
repo_treewidget.setHeaderLabels( TREEVIEW_COLUMNS ) # TODO: Add type, shape, axes, etc.
repo_treewidget.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
repo_treewidget.itemSelectionChanged.connect( self._handle_data_selection )
data_layout = QVBoxLayout()
data_layout.addWidget( repo_treewidget )
data_groupbox = QGroupBox("Data Volumes", parent=self)
data_groupbox.setLayout( data_layout )
node_listwidget = QListWidget(parent=self)
node_listwidget.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
node_listwidget.itemSelectionChanged.connect( self._update_status )
node_layout = QVBoxLayout()
node_layout.addWidget( node_listwidget )
node_groupbox = QGroupBox("Nodes", parent=self)
node_groupbox.setLayout( node_layout )
new_data_edit = QLineEdit(parent=self)
new_data_edit.textEdited.connect( self._update_status )
full_url_label = QLabel(parent=self)
full_url_label.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Maximum )
text_flags = full_url_label.textInteractionFlags()
full_url_label.setTextInteractionFlags( text_flags | Qt.TextSelectableByMouse )
new_data_layout = QVBoxLayout()
new_data_layout.addWidget( new_data_edit )
new_data_groupbox = QGroupBox("New Data Volume", parent=self)
new_data_groupbox.setLayout( new_data_layout )
new_data_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Maximum )
buttonbox = QDialogButtonBox( Qt.Horizontal, parent=self )
buttonbox.setStandardButtons( QDialogButtonBox.Ok | QDialogButtonBox.Cancel )
buttonbox.accepted.connect( self.accept )
buttonbox.rejected.connect( self.reject )
buttonbox.button(QDialogButtonBox.Ok).setEnabled(False)
layout = QVBoxLayout()
layout.addWidget( host_groupbox )
layout.addWidget( data_groupbox )
layout.addWidget( node_groupbox )
if self._mode == "specify_new":
layout.addWidget( new_data_groupbox )
else:
new_data_groupbox.hide()
layout.addWidget( full_url_label )
layout.addWidget( buttonbox )
# Stretch factors
layout.setStretchFactor(data_groupbox, 3)
layout.setStretchFactor(node_groupbox, 1)
self.setLayout(layout)
self.setWindowTitle( "Select DVID Volume" )
self.resize(1000, 1000)
#.........这里部分代码省略.........
示例7: _init_layout
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import hide [as 别名]
def _init_layout(self):
"""
Create the GUI widgets (but leave them empty).
"""
hostname_combobox = QComboBox(parent=self)
self._hostname_combobox = hostname_combobox
hostname_combobox.setEditable(True)
hostname_combobox.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Maximum )
hostname_combobox.installEventFilter(self)
for hostname in self._suggested_hostnames:
hostname_combobox.addItem( hostname )
self._connect_button = QPushButton("Connect", parent=self, clicked=self._handle_new_hostname)
hostname_layout = QHBoxLayout()
hostname_layout.addWidget( hostname_combobox )
hostname_layout.addWidget( self._connect_button )
hostname_groupbox = QGroupBox("DVID Host", parent=self)
hostname_groupbox.setLayout( hostname_layout )
hostname_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Maximum )
data_treewidget = QTreeWidget(parent=self)
data_treewidget.setHeaderLabels( ["Data"] ) # TODO: Add type, shape, axes, etc.
data_treewidget.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
data_treewidget.itemSelectionChanged.connect( self._handle_data_selection )
data_layout = QVBoxLayout()
data_layout.addWidget( data_treewidget )
data_groupbox = QGroupBox("Data Volumes", parent=self)
data_groupbox.setLayout( data_layout )
node_listwidget = QListWidget(parent=self)
node_listwidget.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
node_listwidget.itemSelectionChanged.connect( self._update_display )
node_layout = QVBoxLayout()
node_layout.addWidget( node_listwidget )
node_groupbox = QGroupBox("Nodes", parent=self)
node_groupbox.setLayout( node_layout )
new_data_edit = QLineEdit(parent=self)
new_data_edit.textEdited.connect( self._update_display )
full_url_label = QLabel(parent=self)
full_url_label.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Maximum )
text_flags = full_url_label.textInteractionFlags()
full_url_label.setTextInteractionFlags( text_flags | Qt.TextSelectableByMouse )
new_data_layout = QVBoxLayout()
new_data_layout.addWidget( new_data_edit )
new_data_groupbox = QGroupBox("New Data Volume", parent=self)
new_data_groupbox.setLayout( new_data_layout )
new_data_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Maximum )
buttonbox = QDialogButtonBox( Qt.Horizontal, parent=self )
buttonbox.setStandardButtons( QDialogButtonBox.Ok | QDialogButtonBox.Cancel )
buttonbox.accepted.connect( self.accept )
buttonbox.rejected.connect( self.reject )
buttonbox.button(QDialogButtonBox.Ok).setEnabled(False)
layout = QVBoxLayout()
layout.addWidget( hostname_groupbox )
layout.addWidget( data_groupbox )
layout.addWidget( node_groupbox )
if self._mode == "specify_new":
layout.addWidget( new_data_groupbox )
else:
new_data_groupbox.hide()
layout.addWidget( full_url_label )
layout.addWidget( buttonbox )
# Stretch factors
layout.setStretchFactor(data_groupbox, 3)
layout.setStretchFactor(node_groupbox, 1)
self.setLayout(layout)
self.setWindowTitle( "Select DVID Volume" )
# Initially disabled
data_groupbox.setEnabled(False)
node_groupbox.setEnabled(False)
new_data_groupbox.setEnabled(False)
# Save instance members
self._data_groupbox = data_groupbox
self._node_groupbox = node_groupbox
self._new_data_groupbox = new_data_groupbox
self._data_treewidget = data_treewidget
self._node_listwidget = node_listwidget
self._new_data_edit = new_data_edit
self._full_url_label = full_url_label
self._buttonbox = buttonbox