本文整理汇总了Python中qtpy.QtWidgets.QFrame类的典型用法代码示例。如果您正苦于以下问题:Python QFrame类的具体用法?Python QFrame怎么用?Python QFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent):
QWidget.__init__(self, parent)
vert_layout = QVBoxLayout()
# Type frame
type_layout = QHBoxLayout()
type_label = QLabel(_("Import as"))
type_layout.addWidget(type_label)
self.array_btn = array_btn = QRadioButton(_("array"))
array_btn.setEnabled(ndarray is not FakeObject)
array_btn.setChecked(ndarray is not FakeObject)
type_layout.addWidget(array_btn)
list_btn = QRadioButton(_("list"))
list_btn.setChecked(not array_btn.isChecked())
type_layout.addWidget(list_btn)
if pd:
self.df_btn = df_btn = QRadioButton(_("DataFrame"))
df_btn.setChecked(False)
type_layout.addWidget(df_btn)
h_spacer = QSpacerItem(40, 20,
QSizePolicy.Expanding, QSizePolicy.Minimum)
type_layout.addItem(h_spacer)
type_frame = QFrame()
type_frame.setLayout(type_layout)
self._table_view = PreviewTable(self)
vert_layout.addWidget(type_frame)
vert_layout.addWidget(self._table_view)
self.setLayout(vert_layout)
示例2: __init__
def __init__(self, parent=None):
QFrame.__init__(self, parent)
PyDMPrimitiveWidget.__init__(self)
self._template_filename = ""
self._count_shown_in_designer = 1
self._data_source = ""
self._data = []
self._cached_template = None
self._layout_type = LayoutType.Vertical
self.app = QApplication.instance()
self.rebuild()
示例3: __init__
def __init__(self, parent):
QFrame.__init__(self, parent)
self._webview = WebView(self)
layout = QHBoxLayout()
layout.addWidget(self._webview)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
self._webview.linkClicked.connect(self.linkClicked)
示例4: __init__
def __init__(self, parent=None):
QFrame.__init__(self, parent)
PyDMPrimitiveWidget.__init__(self)
self.app = QApplication.instance()
self._filename = None
self._macros = None
self._embedded_widget = None
self._disconnect_when_hidden = True
self._is_connected = False
self.layout = QVBoxLayout(self)
self.err_label = QLabel(self)
self.err_label.setAlignment(Qt.AlignHCenter)
self.layout.addWidget(self.err_label)
self.layout.setContentsMargins(0, 0, 0, 0)
self.err_label.hide()
if not is_pydm_app():
self.setFrameShape(QFrame.Box)
else:
self.setFrameShape(QFrame.NoFrame)
示例5: __init__
def __init__(self, parent=None, init_channel=None):
QFrame.__init__(self, parent)
PyDMWritableWidget.__init__(self, init_channel=init_channel)
self.alarmSensitiveContent = True
self.alarmSensitiveBorder = False
# Internal values for properties
self._show_limit_labels = True
self._show_value_label = True
self._user_defined_limits = False
self._needs_limit_info = True
self._minimum = None
self._maximum = None
self._user_minimum = -10.0
self._user_maximum = 10.0
self._num_steps = 101
self._orientation = Qt.Horizontal
# Set up all the internal widgets that make up a PyDMSlider.
# We'll add all these things to layouts when we call setup_widgets_for_orientation
label_size_policy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
self.low_lim_label = QLabel(self)
self.low_lim_label.setObjectName("lowLimLabel")
self.low_lim_label.setSizePolicy(label_size_policy)
self.low_lim_label.setAlignment(Qt.AlignLeft | Qt.AlignTrailing | Qt.AlignVCenter)
self.value_label = QLabel(self)
self.value_label.setObjectName("valueLabel")
self.value_label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.high_lim_label = QLabel(self)
self.high_lim_label.setObjectName("highLimLabel")
self.high_lim_label.setSizePolicy(label_size_policy)
self.high_lim_label.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
self._slider = QSlider(parent=self)
self._slider.setOrientation(Qt.Horizontal)
self._slider.sliderMoved.connect(self.internal_slider_moved)
self._slider.sliderPressed.connect(self.internal_slider_pressed)
self._slider.sliderReleased.connect(self.internal_slider_released)
self._slider.valueChanged.connect(self.internal_slider_value_changed)
# self.vertical_layout.addWidget(self._slider)
# Other internal variables and final setup steps
self._slider_position_to_value_map = None
self._mute_internal_slider_changes = False
self.setup_widgets_for_orientation(self._orientation)
self.reset_slider_limits()
示例6: setup_ui
def setup_ui(self):
self.setWindowTitle("Add New Grain")
self.setWindowIcon(QIcon(RESOURCE_PATH + "icons/nakka-finocyl.gif"))
self.resize(400, 400)
controls = QGridLayout()
gb_frame = QGroupBox(self.tr("Grain Design"))
gb_frame.setLayout(controls)
self.cb_grain_type = QComboBox()
# TODO: make grain types auto propagate combobox
self.cb_grain_type.addItems([self.tr("Cylindrical (BATES)")])
controls.addWidget(QLabel(self.tr("Core Shape")), 0, 0)
controls.addWidget(self.cb_grain_type, 0, 1)
self.cb_propellant_type = QComboBox()
self.cb_propellant_type.addItems(app_context.propellant_db.propellant_names())
controls.addWidget(QLabel(self.tr("Propellant Type")), 1, 0)
controls.addWidget(self.cb_propellant_type, 1, 1)
# ok and cancel buttons
btn_ok = QPushButton(self.tr("Apply"))
btn_ok.clicked.connect(self.confirm_grain)
btn_cancel = QPushButton(self.tr("Close"))
btn_cancel.clicked.connect(self.close)
lay_btns = QHBoxLayout()
lay_btns.addWidget(btn_ok)
lay_btns.addWidget(btn_cancel)
frame_btns = QFrame()
frame_btns.setLayout(lay_btns)
# master layout
master = QVBoxLayout()
master.addWidget(gb_frame)
master.addSpacing(10)
master.addWidget(frame_btns)
self.setLayout(master)
示例7: __init__
def __init__(self, img, layout='vertical', order=['R', 'G', 'B', 'V']):
QFrame.__init__(self)
r, g, b, v = histograms(img, 100)
self.r_hist = ColorHistogram(r, (255, 0, 0))
self.g_hist = ColorHistogram(g, (0, 255, 0))
self.b_hist = ColorHistogram(b, (0, 0, 255))
self.v_hist = ColorHistogram(v, (0, 0, 0))
self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
self.layout = QGridLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
order_map = {'R': self.r_hist, 'G': self.g_hist, 'B': self.b_hist,
'V': self.v_hist}
if layout == 'vertical':
for i in range(len(order)):
self.layout.addWidget(order_map[order[i]], i, 0)
elif layout == 'horizontal':
for i in range(len(order)):
self.layout.addWidget(order_map[order[i]], 0, i)
示例8: __init__
def __init__(self, parent=None, init_channel=None):
QFrame.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
self._show_value = True
self._show_limits = True
self.scale_indicator = QScale()
self.value_label = QLabel()
self.lower_label = QLabel()
self.upper_label = QLabel()
self.value_label.setText('<val>')
self.lower_label.setText('<min>')
self.upper_label.setText('<max>')
self._value_position = Qt.TopEdge
self._limits_from_channel = True
self._user_lower_limit = 0
self._user_upper_limit = 0
self.value_label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
self.setup_widgets_for_orientation(Qt.Horizontal, False, False, self._value_position)
示例9: setup_ui
def setup_ui(self):
"""setup the tab widget UI"""
self.tab_widget = QTabWidget()
self.tab_widget.addTab(DesignTab(), "Design")
self.tab_widget.addTab(QWidget(), "Simulation")
self.tab_widget.addTab(QWidget(), "Propellants")
self.layout = QVBoxLayout()
self.layout.addWidget(self.tab_widget)
self.frame = QFrame()
self.frame.setLayout(self.layout)
self.setCentralWidget(self.frame)
示例10: __init__
def __init__(self):
QFrame.__init__(self)
self.setFrameStyle(QFrame.Box | QFrame.Sunken)
self.posx_label = QLabel('X-pos:')
self.posx_value = QLabel()
self.posy_label = QLabel('Y-pos:')
self.posy_value = QLabel()
self.r_label = QLabel('R:')
self.r_value = QLabel()
self.g_label = QLabel('G:')
self.g_value = QLabel()
self.b_label = QLabel('B:')
self.b_value = QLabel()
self.h_label = QLabel('H:')
self.h_value = QLabel()
self.s_label = QLabel('S:')
self.s_value = QLabel()
self.v_label = QLabel('V:')
self.v_value = QLabel()
self.layout = QGridLayout(self)
self.layout.addWidget(self.posx_label, 0, 0)
self.layout.addWidget(self.posx_value, 0, 1)
self.layout.addWidget(self.posy_label, 1, 0)
self.layout.addWidget(self.posy_value, 1, 1)
self.layout.addWidget(self.r_label, 0, 2)
self.layout.addWidget(self.r_value, 0, 3)
self.layout.addWidget(self.g_label, 1, 2)
self.layout.addWidget(self.g_value, 1, 3)
self.layout.addWidget(self.b_label, 2, 2)
self.layout.addWidget(self.b_value, 2, 3)
self.layout.addWidget(self.h_label, 0, 4)
self.layout.addWidget(self.h_value, 0, 5)
self.layout.addWidget(self.s_label, 1, 4)
self.layout.addWidget(self.s_value, 1, 5)
self.layout.addWidget(self.v_label, 2, 4)
self.layout.addWidget(self.v_value, 2, 5)
示例11: __init__
def __init__(self, parent=None):
QFrame.__init__(self, parent)
self.ui = load_ui(__file__, '../../../ui/inelastic/dgs_sample_setup.ui', baseinstance=self)
示例12: __init__
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)
示例13: setup_grain_design
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)
示例14: SkiviImageWindow
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
#.........这里部分代码省略.........
示例15: __init__
def __init__(self, presenter, parent = None, name = '', isMD=False, noExp = 0):
super(SampleLogsView, self).__init__(parent)
self.presenter = presenter
self.setWindowTitle("{} sample logs".format(name))
self.setWindowFlags(Qt.Window)
# Create sample log table
self.table = QTableView()
self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table.clicked.connect(self.presenter.clicked)
self.table.doubleClicked.connect(self.presenter.doubleClicked)
self.table.contextMenuEvent = self.tableMenu
self.addWidget(self.table)
frame_right = QFrame()
layout_right = QVBoxLayout()
#Add full_time and experimentinfo options
layout_options = QHBoxLayout()
if isMD:
layout_options.addWidget(QLabel("Experiment Info #"))
self.experimentInfo = QSpinBox()
self.experimentInfo.setMaximum(noExp-1)
self.experimentInfo.valueChanged.connect(self.presenter.changeExpInfo)
layout_options.addWidget(self.experimentInfo)
self.full_time = QCheckBox("Relative Time")
self.full_time.setChecked(True)
self.full_time.stateChanged.connect(self.presenter.plot_logs)
layout_options.addWidget(self.full_time)
layout_right.addLayout(layout_options)
# Sample log plot
self.fig = Figure()
self.canvas = FigureCanvas(self.fig)
self.canvas.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
self.canvas.mpl_connect('button_press_event', self.presenter.plot_clicked)
self.ax = self.fig.add_subplot(111, projection='mantid')
layout_right.addWidget(self.canvas)
# Sample stats
self.create_stats_widgets()
layout_stats = QFormLayout()
layout_stats.addRow('', QLabel("Log Statistics"))
layout_stats.addRow('Min:', self.stats_widgets["minimum"])
layout_stats.addRow('Max:', self.stats_widgets["maximum"])
layout_stats.addRow('Mean:', self.stats_widgets["mean"])
layout_stats.addRow('Median:', self.stats_widgets["median"])
layout_stats.addRow('Std Dev:', self.stats_widgets["standard_deviation"])
layout_stats.addRow('Time Avg:', self.stats_widgets["time_mean"])
layout_stats.addRow('Time Std Dev:', self.stats_widgets["time_standard_deviation"])
layout_stats.addRow('Duration:', self.stats_widgets["duration"])
layout_right.addLayout(layout_stats)
frame_right.setLayout(layout_right)
self.addWidget(frame_right)
self.setStretchFactor(0,1)
self.resize(1200,800)
self.show()