本文整理匯總了Python中qtpy.QtWidgets.QFrame.setFrameShape方法的典型用法代碼示例。如果您正苦於以下問題:Python QFrame.setFrameShape方法的具體用法?Python QFrame.setFrameShape怎麽用?Python QFrame.setFrameShape使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qtpy.QtWidgets.QFrame
的用法示例。
在下文中一共展示了QFrame.setFrameShape方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from qtpy.QtWidgets import QFrame [as 別名]
# 或者: from qtpy.QtWidgets.QFrame import setFrameShape [as 別名]
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.dir = None
self.runconf = RunConfiguration()
firstrun_o = CONF.get('run', ALWAYS_OPEN_FIRST_RUN_OPTION, False)
# --- Interpreter ---
interpreter_group = QGroupBox(_("Console"))
interpreter_layout = QVBoxLayout()
interpreter_group.setLayout(interpreter_layout)
self.current_radio = QRadioButton(CURRENT_INTERPRETER)
interpreter_layout.addWidget(self.current_radio)
self.dedicated_radio = QRadioButton(DEDICATED_INTERPRETER)
interpreter_layout.addWidget(self.dedicated_radio)
self.systerm_radio = QRadioButton(SYSTERM_INTERPRETER)
interpreter_layout.addWidget(self.systerm_radio)
# --- General settings ----
common_group = QGroupBox(_("General settings"))
common_layout = QGridLayout()
common_group.setLayout(common_layout)
self.clear_var_cb = QCheckBox(CLEAR_ALL_VARIABLES)
common_layout.addWidget(self.clear_var_cb, 0, 0)
self.post_mortem_cb = QCheckBox(POST_MORTEM)
common_layout.addWidget(self.post_mortem_cb, 1, 0)
self.clo_cb = QCheckBox(_("Command line options:"))
common_layout.addWidget(self.clo_cb, 2, 0)
self.clo_edit = QLineEdit()
self.clo_cb.toggled.connect(self.clo_edit.setEnabled)
self.clo_edit.setEnabled(False)
common_layout.addWidget(self.clo_edit, 2, 1)
# --- Working directory ---
wdir_group = QGroupBox(_("Working Directory settings"))
wdir_layout = QVBoxLayout()
wdir_group.setLayout(wdir_layout)
self.file_dir_radio = QRadioButton(FILE_DIR)
wdir_layout.addWidget(self.file_dir_radio)
self.cwd_radio = QRadioButton(CW_DIR)
wdir_layout.addWidget(self.cwd_radio)
fixed_dir_layout = QHBoxLayout()
self.fixed_dir_radio = QRadioButton(FIXED_DIR)
fixed_dir_layout.addWidget(self.fixed_dir_radio)
self.wd_edit = QLineEdit()
self.fixed_dir_radio.toggled.connect(self.wd_edit.setEnabled)
self.wd_edit.setEnabled(False)
fixed_dir_layout.addWidget(self.wd_edit)
browse_btn = QPushButton(ima.icon('DirOpenIcon'), '', self)
browse_btn.setToolTip(_("Select directory"))
browse_btn.clicked.connect(self.select_directory)
fixed_dir_layout.addWidget(browse_btn)
wdir_layout.addLayout(fixed_dir_layout)
# --- System terminal ---
external_group = QGroupBox(_("External system terminal"))
external_group.setDisabled(True)
self.systerm_radio.toggled.connect(external_group.setEnabled)
external_layout = QGridLayout()
external_group.setLayout(external_layout)
self.interact_cb = QCheckBox(INTERACT)
external_layout.addWidget(self.interact_cb, 1, 0, 1, -1)
self.pclo_cb = QCheckBox(_("Command line options:"))
external_layout.addWidget(self.pclo_cb, 3, 0)
self.pclo_edit = QLineEdit()
self.pclo_cb.toggled.connect(self.pclo_edit.setEnabled)
self.pclo_edit.setEnabled(False)
self.pclo_edit.setToolTip(_("<b>-u</b> is added to the "
"other options you set here"))
external_layout.addWidget(self.pclo_edit, 3, 1)
# Checkbox to preserve the old behavior, i.e. always open the dialog
# on first run
hline = QFrame()
hline.setFrameShape(QFrame.HLine)
hline.setFrameShadow(QFrame.Sunken)
self.firstrun_cb = QCheckBox(ALWAYS_OPEN_FIRST_RUN % _("this dialog"))
self.firstrun_cb.clicked.connect(self.set_firstrun_o)
self.firstrun_cb.setChecked(firstrun_o)
layout = QVBoxLayout()
layout.addWidget(interpreter_group)
layout.addWidget(common_group)
layout.addWidget(wdir_group)
layout.addWidget(external_group)
layout.addWidget(hline)
layout.addWidget(self.firstrun_cb)
self.setLayout(layout)
示例2: __init__
# 需要導入模塊: from qtpy.QtWidgets import QFrame [as 別名]
# 或者: from qtpy.QtWidgets.QFrame import setFrameShape [as 別名]
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.current_radio = None
self.dedicated_radio = None
self.systerm_radio = None
self.runconf = RunConfiguration()
firstrun_o = CONF.get("run", ALWAYS_OPEN_FIRST_RUN_OPTION, False)
# --- General settings ----
common_group = QGroupBox(_("General settings"))
common_layout = QGridLayout()
common_group.setLayout(common_layout)
self.clo_cb = QCheckBox(_("Command line options:"))
common_layout.addWidget(self.clo_cb, 0, 0)
self.clo_edit = QLineEdit()
self.clo_cb.toggled.connect(self.clo_edit.setEnabled)
self.clo_edit.setEnabled(False)
common_layout.addWidget(self.clo_edit, 0, 1)
self.wd_cb = QCheckBox(_("Working directory:"))
common_layout.addWidget(self.wd_cb, 1, 0)
wd_layout = QHBoxLayout()
self.wd_edit = QLineEdit()
self.wd_cb.toggled.connect(self.wd_edit.setEnabled)
self.wd_edit.setEnabled(False)
wd_layout.addWidget(self.wd_edit)
browse_btn = QPushButton(ima.icon("DirOpenIcon"), "", self)
browse_btn.setToolTip(_("Select directory"))
browse_btn.clicked.connect(self.select_directory)
wd_layout.addWidget(browse_btn)
common_layout.addLayout(wd_layout, 1, 1)
self.post_mortem_cb = QCheckBox(_("Enter debugging mode when " "errors appear during execution"))
common_layout.addWidget(self.post_mortem_cb)
# --- Interpreter ---
interpreter_group = QGroupBox(_("Console"))
interpreter_layout = QVBoxLayout()
interpreter_group.setLayout(interpreter_layout)
self.current_radio = QRadioButton(CURRENT_INTERPRETER)
interpreter_layout.addWidget(self.current_radio)
self.dedicated_radio = QRadioButton(DEDICATED_INTERPRETER)
interpreter_layout.addWidget(self.dedicated_radio)
self.systerm_radio = QRadioButton(SYSTERM_INTERPRETER)
interpreter_layout.addWidget(self.systerm_radio)
# --- Dedicated interpreter ---
new_group = QGroupBox(_("Dedicated Python console"))
self.current_radio.toggled.connect(new_group.setDisabled)
new_layout = QGridLayout()
new_group.setLayout(new_layout)
self.interact_cb = QCheckBox(_("Interact with the Python " "console after execution"))
new_layout.addWidget(self.interact_cb, 1, 0, 1, -1)
self.show_kill_warning_cb = QCheckBox(_("Show warning when killing" " running process"))
new_layout.addWidget(self.show_kill_warning_cb, 2, 0, 1, -1)
self.pclo_cb = QCheckBox(_("Command line options:"))
new_layout.addWidget(self.pclo_cb, 3, 0)
self.pclo_edit = QLineEdit()
self.pclo_cb.toggled.connect(self.pclo_edit.setEnabled)
self.pclo_edit.setEnabled(False)
self.pclo_edit.setToolTip(_("<b>-u</b> is added to the " "other options you set here"))
new_layout.addWidget(self.pclo_edit, 3, 1)
# Checkbox to preserve the old behavior, i.e. always open the dialog
# on first run
hline = QFrame()
hline.setFrameShape(QFrame.HLine)
hline.setFrameShadow(QFrame.Sunken)
self.firstrun_cb = QCheckBox(ALWAYS_OPEN_FIRST_RUN % _("this dialog"))
self.firstrun_cb.clicked.connect(self.set_firstrun_o)
self.firstrun_cb.setChecked(firstrun_o)
layout = QVBoxLayout()
layout.addWidget(interpreter_group)
layout.addWidget(common_group)
layout.addWidget(new_group)
layout.addWidget(hline)
layout.addWidget(self.firstrun_cb)
self.setLayout(layout)
示例3: setup_grain_design
# 需要導入模塊: from qtpy.QtWidgets import QFrame [as 別名]
# 或者: from qtpy.QtWidgets.QFrame import setFrameShape [as 別名]
def setup_grain_design():
# grain table view
master = QHBoxLayout(self)
master.addWidget(QTableView())
# grain design controls
controls = QVBoxLayout(self)
# add a push button
self.btn_new_grain = QPushButton(self.tr("New Grain"))
self.btn_new_grain.setMinimumHeight(50)
controls.addWidget(self.btn_new_grain)
# add a dividing line
line = QFrame()
line.setFrameShape(QFrame.HLine)
line.setFrameShadow(QFrame.Sunken)
controls.addSpacing(5)
controls.addWidget(line)
# rest of the controls buttons
self.btn_edit_grain = QPushButton(self.tr("Edit"))
self.btn_edit_grain.setMinimumHeight(30)
controls.addWidget(self.btn_edit_grain)
self.btn_delete_Grain = QPushButton(self.tr("Delete"))
self.btn_delete_Grain.setMinimumHeight(30)
controls.addWidget(self.btn_delete_Grain)
# move grain up and down
moveup = QHBoxLayout()
self.btn_move_up = QToolButton()
self.btn_move_up.setArrowType(Qt.UpArrow)
moveup.addWidget(self.btn_move_up)
moveup.addWidget(QLabel(self.tr("Move Up")))
controls.addLayout(moveup)
movedown = QHBoxLayout()
self.btn_move_down = QToolButton()
self.btn_move_down.setArrowType(Qt.DownArrow)
movedown.addWidget(self.btn_move_down)
movedown.addWidget(QLabel(self.tr("Move Down")))
controls.addLayout(movedown)
controls.addStretch()
# add info for motor design
fl_propellant_info = QFormLayout()
gb_motor_info = QGroupBox(self.tr("Propellant Info"))
gb_motor_info.setLayout(fl_propellant_info)
self.lbl_num_grains = QLabel()
fl_propellant_info.addRow(QLabel(self.tr("Number of Segments:")), self.lbl_num_grains)
self.lbl_motor_dia = QLabel()
fl_propellant_info.addRow(QLabel(self.tr("Motor Diameter:")), self.lbl_motor_dia)
self.lbl_motor_len = QLabel()
fl_propellant_info.addRow(QLabel(self.tr("Propellant Length:")), self.lbl_motor_len)
self.lbl_prop_mass = QLabel()
fl_propellant_info.addRow(QLabel(self.tr("Propellant Mass:")), self.lbl_prop_mass)
self.lbl_volume_loading = QLabel()
fl_propellant_info.addRow(QLabel(self.tr("Volume Loading:")), self.lbl_volume_loading)
# set group box's layout
controls.addWidget(gb_motor_info)
# setup master layout
master.addLayout(controls)
self.gb_design = QGroupBox(self.tr("Grain Design"))
self.gb_design.setLayout(master)
示例4: SkiviImageWindow
# 需要導入模塊: from qtpy.QtWidgets import QFrame [as 別名]
# 或者: from qtpy.QtWidgets.QFrame import setFrameShape [as 別名]
class SkiviImageWindow(QMainWindow):
def __init__(self, arr, mgr):
QMainWindow.__init__(self)
self.arr = arr
self.mgr = mgr
self.main_widget = QWidget()
self.layout = QGridLayout(self.main_widget)
self.setCentralWidget(self.main_widget)
self.label = ImageLabel(self, arr)
self.label_container = QFrame()
self.label_container.setFrameShape(QFrame.StyledPanel | QFrame.Sunken)
self.label_container.setLineWidth(1)
self.label_container.layout = QGridLayout(self.label_container)
self.label_container.layout.setContentsMargins(0, 0, 0, 0)
self.label_container.layout.addWidget(self.label, 0, 0)
self.layout.addWidget(self.label_container, 0, 0)
self.mgr.add_window(self)
self.main_widget.show()
self.setWindowTitle('Skivi - The skimage viewer.')
self.mixer_panel = MixerPanel(self.arr)
self.layout.addWidget(self.mixer_panel, 0, 2)
self.mixer_panel.show()
self.mixer_panel.set_callback(self.refresh_image)
self.rgbv_hist = QuadHistogram(self.arr)
self.layout.addWidget(self.rgbv_hist, 0, 1)
self.rgbv_hist.show()
self.rgb_hsv_disp = RGBHSVDisplay()
self.layout.addWidget(self.rgb_hsv_disp, 1, 0)
self.rgb_hsv_disp.show()
self.layout.setColumnStretch(0, 1)
self.layout.setRowStretch(0, 1)
self.save_file = QtWidgets.QPushButton('Save to File')
self.save_file.clicked.connect(self.save_to_file)
self.save_stack = QtWidgets.QPushButton('Save to Stack')
self.save_stack.clicked.connect(self.save_to_stack)
self.save_file.show()
self.save_stack.show()
self.layout.addWidget(self.save_stack, 1, 1)
self.layout.addWidget(self.save_file, 1, 2)
def closeEvent(self, event):
# Allow window to be destroyed by removing any
# references to it
self.mgr.remove_window(self)
def update_histograms(self):
self.rgbv_hist.update_hists(self.arr)
def refresh_image(self):
self.label.update_image()
self.update_histograms()
def scale_mouse_pos(self, x, y):
width = self.label.pm.width()
height = self.label.pm.height()
x_frac = 1. * x / width
y_frac = 1. * y / height
width = self.arr.shape[1]
height = self.arr.shape[0]
new_x = int(width * x_frac)
new_y = int(height * y_frac)
return(new_x, new_y)
def label_mouseMoveEvent(self, evt):
x = evt.x()
y = evt.y()
x, y = self.scale_mouse_pos(x, y)
# handle tracking out of array bounds
maxw = self.arr.shape[1]
maxh = self.arr.shape[0]
if x >= maxw or y >= maxh or x < 0 or y < 0:
r = g = b = h = s = v = ''
else:
r = self.arr[y, x, 0]
g = self.arr[y, x, 1]
b = self.arr[y, x, 2]
h, s, v = self.mixer_panel.mixer.rgb_2_hsv_pixel(r, g, b)
self.rgb_hsv_disp.update_vals((x, y, r, g, b, h, s, v))
def save_to_stack(self):
from ... import io
img = self.arr.copy()
io.push(img)
msg = dedent('''
The image has been pushed to the io stack.
Use io.pop() to retrieve the most recently
#.........這裏部分代碼省略.........