def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(576, 522) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QtCore.QSize(100, 150)) self.im_view = QtGui.QWidget(MainWindow) self.im_view.setMinimumSize(QtCore.QSize(50, 50)) self.im_view.setObjectName("im_view") self.horizontalLayout = QtGui.QHBoxLayout(self.im_view) self.horizontalLayout.setObjectName("horizontalLayout") MainWindow.setCentralWidget(self.im_view) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.toolbar = QtGui.QToolBar(MainWindow) self.toolbar.setObjectName("toolbar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolbar) self.action_close = QtGui.QAction(MainWindow) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/image/close.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_close.setIcon(icon) self.action_close.setObjectName("action_close") self.action_snapshot = QtGui.QAction(MainWindow) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/image/snapshot.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_snapshot.setIcon(icon1) self.action_snapshot.setObjectName("action_snapshot") self.action_rotate_left = QtGui.QAction(MainWindow) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/image/rotate_left.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_rotate_left.setIcon(icon2) self.action_rotate_left.setObjectName("action_rotate_left") self.action_rotate_right = QtGui.QAction(MainWindow) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/image/rotate_right.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.action_rotate_right.setIcon(icon3) self.action_rotate_right.setObjectName("action_rotate_right") self.toolbar.addAction(self.action_close) self.toolbar.addAction(self.action_snapshot) self.toolbar.addAction(self.action_rotate_left) self.toolbar.addAction(self.action_rotate_right) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, siblings=[], parent=None): QtGui.QTreeView.__init__(self, parent) NodeFactoryView.__init__(self, siblings) self.setDragEnabled(True) self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.setIconSize(QtCore.QSize(25,25)) self.setHeaderHidden(True)
def __init__(self, layout=None, **kwds): """ tests: list of function runnable in shell (name changed to run_<funcname>) layout_file """ OALabMainWin.__init__(self, layout=layout, **kwds) self.interp = interpreter() self.interp.user_ns['mainwin'] = self self.interp.user_ns['splittable'] = self.splittable self.interp.user_ns['debug'] = self.debug self.interp.user_ns['QtCore'] = QtCore self.interp.user_ns['QtGui'] = QtGui from openalea.core.service.plugin import plugin_instance, plugin_instances def applet(name): return plugin_instance('oalab.applet', name) def applets(name): return plugin_instances('oalab.applet', name) self.interp.user_ns['applet'] = applet self.interp.user_ns['applets'] = applets print 'functions:' for f in kwds.pop('tests', []): self.interp.user_ns['run_%s' % f.__name__] = f print 'run_%s' % f.__name__ self.resize(QtCore.QSize(800, 600))
def __init__(self, model, parent=None): QtGui.QTreeView.__init__(self, parent) self.setModel(model) self.expandAll() self.setHeaderHidden(True) self.setDragEnabled(True) self.setIconSize(QtCore.QSize(16, 16)) self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.onContextMenuRequest)
def __init__(self, parent=None): QtGui.QTreeView.__init__(self, parent=parent) self.setContentsMargins(0, 0, 0, 0) self._model = ManagerExplorerModel() self.setModel(self._model) self.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.setIconSize(QtCore.QSize(24, 24)) self.setHeaderHidden(True)
def _fill_layout(self, buttons): # compute size info self.nx = self._compute_layout_info() # clear old widgets for i in reversed(range(self._layout.count())): widget = self._layout.itemAt(i).widget() widget.setParent(None) self._layout.removeWidget(widget) style = self._style_kwargs # place new widgets for i, button in enumerate(buttons): button.setStyleSheet(style['stylesheet']) button.setFixedSize(QtCore.QSize(*style['button_size'])) qsize = QtCore.QSize(*style['icon_size']) button.setIconSize(qsize) self._layout.addWidget(button, i / self.nx, i % self.nx)
class WelcomePage(QtGui.QWidget): """ Create a widget page that display a list of actions as buttons """ button_size = QtCore.QSize(200, 100) icon_size = QtCore.QSize(80, 80) stylesheet = "font-size: 12pt;" def __init__(self, actions=None, parent=None): QtGui.QWidget.__init__(self) self._layout = QtGui.QGridLayout(self) self._layout.setAlignment(QtCore.Qt.AlignCenter) if actions: self.set_actions(actions) def set_actions(self, actions): for i in reversed(range(self._layout.count())): widget = self._layout.itemAt(i).widget() widget.setParent(None) self._layout.removeWidget(widget) w = self.size().width() nx = w / self.button_size.width() if nx == 0: nx = 1 for i, action in enumerate(actions): button = QtGui.QToolButton() button.setFixedSize(self.button_size) # button.setStyleSheet(self.stylesheet) button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) qsize = QtCore.QSize(self.icon_size) button.setDefaultAction(action) button.setIconSize(qsize) self._layout.addWidget(button, i / nx, i % nx)
def set_actions(self, actions): for i in reversed(range(self._layout.count())): widget = self._layout.itemAt(i).widget() widget.setParent(None) self._layout.removeWidget(widget) w = self.size().width() nx = w / self.button_size.width() if nx == 0: nx = 1 for i, action in enumerate(actions): button = QtGui.QToolButton() button.setFixedSize(self.button_size) # button.setStyleSheet(self.stylesheet) button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) qsize = QtCore.QSize(self.icon_size) button.setDefaultAction(action) button.setIconSize(qsize) self._layout.addWidget(button, i / nx, i % nx)
__revision__ = "" from openalea.vpltk.qt import QtGui, QtCore """ # To generate images from openalea.lpy.gui.compile_ui import check_rc_generation check_rc_generation('resources.qrc') """ Policy = QtGui.QSizePolicy size_policy_xsmall = Policy(Policy.Maximum, Policy.Preferred) size_policy_ysmall = Policy(Policy.Preferred, Policy.Maximum) size_policy_preferred = Policy(Policy.Preferred, Policy.Preferred) big_btn_size = QtCore.QSize(25, 25) small_btn_size = QtCore.QSize(140, 16) big_icon_size = QtCore.QSize(24, 24) small_icon_size = QtCore.QSize(16, 16) paned_menu_size = QtCore.QSize(10000, 80) style_paned_menu = """ QWidget { } """ style_pane = """ QWidget { }
def sizeHint(self): return QtCore.QSize(300, 300)