def __init__(self, parent, level_selection): """ Initialize the Level Selection View """ QFrame.__init__(self)#, parent) self.resize(640, 480) self.level_selection = level_selection self.setFocusPolicy(Qt.StrongFocus) self.color = QColor(200, 200, 200) self.setStyleSheet("QFrame { background-color: %s }" % self.color.name()) self.levelDetailsView = LevelDetailsView(self.level_selection, parent=self) width = self.ENTRIES_PER_ROW*LevelOverviewView.WIDTH+32 self.levelDetailsView.move(width, 0) self.levelDetailsView.resize(640-width, 480) self.levelOverviews = [] for level in level_selection.levels: overview = LevelOverviewView(self, level, level_selection) self.levelOverviews.append(overview) for i in range(len(self.levelOverviews)): overview = self.levelOverviews[i] overview.move(16+(i%self.ENTRIES_PER_ROW)*LevelOverviewView.WIDTH, 32+i/self.ENTRIES_PER_ROW*LevelOverviewView.HEIGHT)
def __init__(self, weaponCautionClue, parent=None): """ Initialize the Weapon Caution Clue View """ QFrame.__init__(self, parent) self.weaponCautionClue = weaponCautionClue self.resize(16, 15) self.loadImage() self.setVisible(False)
def __init__(self, parent, level_selection): """ Initialize the Level Selection View """ QFrame.__init__(self) #, parent) self.resize(640, 480) self.level_selection = level_selection self.setFocusPolicy(Qt.StrongFocus) self.color = QColor(200, 200, 200) self.setStyleSheet("QFrame { background-color: %s }" % self.color.name()) self.levelDetailsView = LevelDetailsView(self.level_selection, parent=self) width = self.ENTRIES_PER_ROW * LevelOverviewView.WIDTH + 32 self.levelDetailsView.move(width, 0) self.levelDetailsView.resize(640 - width, 480) self.levelOverviews = [] for level in level_selection.levels: overview = LevelOverviewView(self, level, level_selection) self.levelOverviews.append(overview) for i in range(len(self.levelOverviews)): overview = self.levelOverviews[i] overview.move( 16 + (i % self.ENTRIES_PER_ROW) * LevelOverviewView.WIDTH, 32 + i / self.ENTRIES_PER_ROW * LevelOverviewView.HEIGHT)
def __init__(self, adjacencyClue, fragilityClue, parent=None): """ Initialize the Adjacency Clue View """ QFrame.__init__(self, parent) self.adjacencyClue = adjacencyClue self.fragilityClue = fragilityClue self.resize(34, 32) self.setupClueLabel()
def createDisplayFields(self): display_widget = QFrame() display_widget.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Sunken) self.left_layout.addWidget(display_widget) self.display_layout = QHBoxLayout() # self.turn = self.transcript.current_turn() self.time_field = qHotField("time", str, "00:00:00", min_size=75, max_size=75, pos="top", handler=self.update_time) self.display_layout.addWidget(self.time_field) self.speaker_field = qHotField("speaker", str, " ", min_size=75, max_size=75, pos="top", handler=self.update_speaker) self.display_layout.addWidget(self.speaker_field) self.utt_field = qHotField("utterance", str, " ", min_size=350, max_size=500, pos="top", handler=self.update_utterance, multiline=True) self.utt_field.setStyleSheet("font: 14pt \"Courier\";") # self.utt_field.efield.setFont(QFont('SansSerif', 12)) self.display_layout.addWidget(self.utt_field) display_widget.setLayout(self.display_layout) self.display_layout.setStretchFactor(self.speaker_field, 0) self.display_layout.setStretchFactor(self.utt_field, 1) self.transcript_slider = QSlider(QtCore.Qt.Horizontal, self) self.display_layout.addWidget(self.transcript_slider) self.transcript_slider.setMaximum(100) self.connect(self.transcript_slider, QtCore.SIGNAL("sliderMoved(int)"), self.position_transcript) self.left_layout.addWidget(self.transcript_slider)
def __init__(self, plugin, *args): QFrame.__init__(self, *args) self.plugin = plugin self.config_main = self.plugin.config_main self.config_theme = self.plugin.config_theme self.tools = self.plugin.tools self.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) self.edit = self.PlainTextEdit(self) self.number_bar = self.NumberBar(self.config_theme, self.edit) hbox = QHBoxLayout(self) hbox.setSpacing(0) hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.blockCountChanged.connect(self.number_bar.adjust_width) self.edit.updateRequest.connect(self.number_bar.update_contents) QtGui.QShortcut(QtGui.QKeySequence("Ctrl+S"), self).\ activated.connect(self.save_file) QtGui.QShortcut(QtGui.QKeySequence("Ctrl+F"), self).\ activated.connect(self.show_find) return
def __init__(self, plugin, *args): QFrame.__init__(self, *args) self.plugin = plugin self.config_main = self.plugin.config_main self.config_theme = self.plugin.config_theme self.tools = self.plugin.tools self.lvars = self.plugin.lvars self.setFrameStyle(QFrame.StyledPanel | QFrame.Plain) self.edit = self.PlainTextEdit(self) self.number_bar = self.NumberBar(self.config_theme, self.edit) hbox = QHBoxLayout(self) hbox.setSpacing(0) hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.blockCountChanged.connect(self.number_bar.adjust_width) self.edit.updateRequest.connect(self.number_bar.update_contents) QtGui.QShortcut(QtGui.QKeySequence("Ctrl+S"), self).\ activated.connect(self.save_file) QtGui.QShortcut(QtGui.QKeySequence("Ctrl+F"), self).\ activated.connect(self.show_find) return
def init_notebooks(self): frame = QFrame() layout = QVBoxLayout() frame.setLayout(layout) self.ui.scrollArea.setWidget(frame) for notebook_struct in self.app.provider.list_notebooks(): notebook = Notebook.from_tuple(notebook_struct) count = self.app.provider.get_notebook_notes_count(notebook.id) widget = QWidget() menu = QMenu(self) menu.addAction(self.tr('Change Name'), Slot()(partial( self.change_notebook, notebook=notebook, ))) action = menu.addAction(self.tr('Remove Notebook'), Slot()(partial( self.remove_notebook, notebook=notebook, ))) action.setEnabled(False) widget.ui = Ui_Notebook() widget.ui.setupUi(widget) widget.ui.name.setText(notebook.name) widget.ui.content.setText(self.tr('Containts %d notes') % count) widget.ui.actionBtn.setIcon(QIcon.fromTheme('gtk-properties')) widget.setFixedHeight(50) layout.addWidget(widget) widget.ui.actionBtn.clicked.connect(Slot()(partial( self.show_notebook_menu, menu=menu, widget=widget, )))
def _init_load_options_tab(self, tab): # auto load libs auto_load_libs = QCheckBox(self) auto_load_libs.setText("Automatically load all libraries") auto_load_libs.setChecked(False) self.option_widgets['auto_load_libs'] = auto_load_libs # dependencies list dep_group = QGroupBox("Dependencies") dep_list = QListWidget(self) self.option_widgets['dep_list'] = dep_list sublayout = QVBoxLayout() sublayout.addWidget(dep_list) dep_group.setLayout(sublayout) layout = QVBoxLayout() layout.addWidget(auto_load_libs) layout.addWidget(dep_group) layout.addStretch(0) frame = QFrame(self) frame.setLayout(layout) tab.addTab(frame, "Loading Options")
def __init__(self, parent, change_tracker: ChangeTracker): super(CommentsWidget, self).__init__(parent) self._change_tracker = change_tracker #self.setObjectName("zwhite") layout = QVBoxLayout() self.comments_list_widget = QFrame( self ) # If you use QWidget, the background won't be set; don't know why :-( self.comments_list_widget.setStyleSheet("background: white;") self.comments_list_widget.setAutoFillBackground(True) #self.comments_list_widget.setObjectName("zwhite") self._comments_layout = QVBoxLayout() self.comments_list_widget.setLayout(self._comments_layout) self.comments_list_widget.hide() self.text_edit = QTextEdit(self) self.submit_button = QPushButton(("Add"), self) layout.addWidget(self.comments_list_widget) layout.addWidget(self.text_edit) hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(self.submit_button) layout.addLayout(hlayout) self.setLayout(layout) self.submit_button.clicked.connect(self.submit_comment)
def __init__(self, *args, **kwrgs): existing_widgets = Window.mayaWin.findChildren(QDialog, Window.objectName) if existing_widgets: map(lambda x: x.deleteLater(), existing_widgets) super(Window, self).__init__(*args, **kwrgs) self.installEventFilter(self) self.setObjectName(Window.objectName) self.setWindowTitle(Window.title) mainLayout = QVBoxLayout(self) w_rendererSelect = Widget_chooseRenderer() w_resolusion = Widget_resolusion() optimizer = QFrame() optimizer.setFrameShape(QFrame.HLine) button_sep = QPushButton("SEPARATE") listWidget = QListWidget() listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) button_convert = QPushButton("CONVERT TO LAMBERT") button_convert.setEnabled(False) mainLayout.addWidget(w_rendererSelect) mainLayout.addWidget(w_resolusion) mainLayout.addWidget(button_sep) mainLayout.addWidget(listWidget) mainLayout.addWidget(button_convert) self.resize(Window.defaultWidth, Window.defaultHeight) self.load_shapeInfo(Window.path_uiInfo) self.w_rendererSelect = w_rendererSelect self.w_resolusion = w_resolusion self.listWidget = listWidget self.button_convert = button_convert QtCore.QObject.connect(button_sep, QtCore.SIGNAL("clicked()"), self.separate) QtCore.QObject.connect(button_convert, QtCore.SIGNAL("clicked()"), self.convert) QtCore.QObject.connect(listWidget, QtCore.SIGNAL("itemSelectionChanged()"), self.selectShader) try: Cmds_mainCommands.get_csv_form_google_spreadsheets( Window.shaderAttr_url, Window.shaderAttr_csv) except: pass self.dict_shaderAttr = Cmds_mainCommands.get_dictdata_from_csvPath( Window.shaderAttr_csv) try: Cmds_mainCommands.get_csv_form_google_spreadsheets( Window.removeTarget_url, Window.removeTarget_csv) except: pass self.dict_removeTargets = Cmds_mainCommands.get_dictdata_from_csvPath( Window.removeTarget_csv)
def VerticalDivider(): """ Creates a vertical divider line. :return: """ divider = QFrame() divider.setFrameShape(QFrame.VLine) divider.setFrameShadow(QFrame.Raised) return divider
def _init_widgets(self): state = self._state if state is None: return if state.arch.name not in self.ARCH_REGISTERS: l.error( "Architecture %s is not listed in QRegisterViewer.ARCH_REGISTERS.", state.arch.name) return layout = QVBoxLayout() area = QScrollArea() area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setWidgetResizable(True) regs = self.ARCH_REGISTERS[state.arch.name] # common ones common_regs = regs['common'] for reg_name in common_regs: sublayout = QHBoxLayout() lbl_reg_name = QLabel(self) lbl_reg_name.setProperty('class', 'reg_viewer_label') lbl_reg_name.setText(reg_name) lbl_reg_name.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sublayout.addWidget(lbl_reg_name) sublayout.addSpacing(10) reg_value = QASTViewer(None, parent=self) self._registers[reg_name] = reg_value sublayout.addWidget(reg_value) layout.addLayout(sublayout) layout.setSpacing(0) layout.addStretch(0) layout.setContentsMargins(2, 2, 2, 2) # the container container = QFrame() container.setAutoFillBackground(True) palette = container.palette() palette.setColor(container.backgroundRole(), Qt.white) container.setPalette(palette) container.setLayout(layout) area.setWidget(container) base_layout = QVBoxLayout() base_layout.addWidget(area) self.setLayout(base_layout)
def HorizontalDivider(): """ Creates a horizontal divider line. :return: """ divider = QFrame() divider.setFrameShape(QFrame.HLine) divider.setFrameShadow(QFrame.Raised) return divider
def _init_pathgroups_tab(self, tab): # pathgroups list pathgroups_label = QLabel(self) pathgroups_label.setText('PathGroup') pathgroups_list = QComboBox(self) self._pathgroups_list = pathgroups_list pg_layout = QHBoxLayout() pg_layout.addWidget(pathgroups_label) pg_layout.addWidget(pathgroups_list) # path group information viewer = QPathGroupViewer(None) self._pathgroup_viewer = viewer # # Buttons # # step button step_button = QPushButton() step_button.setText('Step Path Group') step_button.released.connect(self._on_step_clicked) # step until branch step_until_branch_button = QPushButton('Step Path Group until branch') step_until_branch_button.released.connect( self._on_step_until_branch_clicked) # explore button explore_button = QPushButton('Explore') explore_button.released.connect(self._on_explore_clicked) # buttons layout buttons_layout = QVBoxLayout() layout = QHBoxLayout() layout.addWidget(explore_button) buttons_layout.addLayout(layout) layout = QHBoxLayout() layout.addWidget(step_button) layout.addWidget(step_until_branch_button) buttons_layout.addLayout(layout) pathgroups_layout = QVBoxLayout() pathgroups_layout.addLayout(pg_layout) pathgroups_layout.addWidget(viewer) pathgroups_layout.addLayout(buttons_layout) frame = QFrame() frame.setLayout(pathgroups_layout) tab.addTab(frame, 'General')
def __init__(self): generic.GenericGui.__init__(self) window = QWidget() window.setWindowTitle('quichem-pyside') self.compiler_view = QListWidget() self.compiler_view.currentRowChanged.connect(self.show_source) self.stacked_widget = QStackedWidget() self.stacked_widget.setFrameStyle(QFrame.StyledPanel | QFrame.Raised) self.edit = QLineEdit() self.edit.setPlaceholderText('Type quichem input...') self.edit.textChanged.connect(self.change_value) self.view = QWebView() self.view.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) self.view.page().action(QWebPage.Reload).setVisible(False) self.view.setMaximumHeight(0) self.view.setUrl('qrc:/web/page.html') self.view.setZoomFactor(2) self.view.page().mainFrame().contentsSizeChanged.connect( self._resize_view) # For debugging JS: ## from PySide.QtWebKit import QWebSettings ## QWebSettings.globalSettings().setAttribute( ## QWebSettings.DeveloperExtrasEnabled, True) button_image = QPushButton('Copy as Image') button_image.clicked.connect(self.set_clipboard_image) button_image.setToolTip('Then paste into any graphics program') button_word = QPushButton('Copy as MS Word Equation') button_word.clicked.connect(self.set_clipboard_word) button_html = QPushButton('Copy as Formatted Text') button_html.clicked.connect(self.set_clipboard_html) line = QFrame() line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) button_layout = QHBoxLayout() button_layout.addStretch() button_layout.addWidget(button_image) button_layout.addWidget(button_word) button_layout.addWidget(button_html) source_layout = QHBoxLayout() source_layout.addWidget(self.compiler_view) source_layout.addWidget(self.stacked_widget, 1) QVBoxLayout(window) window.layout().addWidget(self.edit) window.layout().addWidget(self.view) window.layout().addLayout(button_layout) window.layout().addWidget(line) window.layout().addLayout(source_layout, 1) window.show() window.resize(window.minimumWidth(), window.height()) # To prevent garbage collection of internal Qt object. self._window = window
def __init__(self, parent): """ Initialize the Kao Widget With Menu """ QFrame.__init__(self) self.parentWidget = parent self.__left_widget__, self.__right_widget__ = self.setupWidgets() self.setPieceSizes() layout = QHBoxLayout(self) layout.addWidget(self.__left_widget__) layout.addWidget(self.__right_widget__) self.setLayout(layout)
def __init__(self, level, width, height, parent=None): """ Initialize the Level Completion View """ QFrame.__init__(self, parent) self.level = level self.setup() self.updateView() self.color = QColor(200, 200, 200) self.setStyleSheet("QFrame { background-color: %s }" % self.color.name()) self.resize(width, height)
def __init__(self, parent, level): """ Initialize the Level View """ QFrame.__init__(self, parent) self.level = level self.background = BackgroundView() self.enemy_view = EnemyShipView(self.level.enemy) self.ship_view = HeroShipView(self.level.ship) self.laser_views = [] self.setFocusPolicy(Qt.StrongFocus)
def __init__(self, minefield, drone, parent=None): """ Initialize the grid square view """ QFrame.__init__(self, parent) self.minefield = minefield self.drone = drone self.row = 0 self.column = 0 self.setup() self.resize(self.getWidth(), self.getHeight())
def __init__(self, parent=None): """ Default class constructor. :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_ """ super(CmdPrompt, self).__init__(parent) qDebug("CmdPrompt Constructor") self.setObjectName("Command Prompt") self.promptInput = promptInput = CmdPromptInput(self) self.promptHistory = CmdPromptHistory() self.promptDivider = QFrame(self) promptVBoxLayout = QVBoxLayout(self) self.promptSplitter = CmdPromptSplitter(self) self.setFocusProxy(promptInput) self.promptHistory.setFocusProxy(promptInput) self.promptDivider.setLineWidth(1) self.promptDivider.setFrameStyle(QFrame.HLine) QWIDGETSIZE_MAX = 1 # TODO/FIXME. What is QWIDGETSIZE_MAX??? self.promptDivider.setMaximumSize(QWIDGETSIZE_MAX, 1) promptVBoxLayout.addWidget(self.promptSplitter) promptVBoxLayout.addWidget(self.promptHistory) promptVBoxLayout.addWidget(self.promptDivider) promptVBoxLayout.addWidget(promptInput) promptVBoxLayout.setSpacing(0) promptVBoxLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(promptVBoxLayout) #TODO# self.styleHash = QHash<QString, QString>() #TODO# self.styleHash.insert("color", "#000000") # Match -------| #TODO# self.styleHash.insert("background-color", "#FFFFFF") # | #TODO# self.styleHash.insert("selection-color", "#FFFFFF") # | #TODO# self.styleHash.insert("selection-background-color", "#000000") # Match -------| #TODO# self.styleHash.insert("font-family", "Monospace") #TODO# self.styleHash.insert("font-style", "normal") #TODO# self.styleHash.insert("font-size", "12px") # self.updateStyle() self.blinkState = False self.blinkTimer = QTimer(self) self.blinkTimer.timeout.connect(self.blink) self.show()
def _init_avoids_tab(self, tab): avoids_list = QListWidget() self._avoids_list = avoids_list layout = QVBoxLayout() layout.addWidget(avoids_list) frame = QFrame() frame.setLayout(layout) tab.addTab(frame, 'Avoids')
def __init__(self, parent=None, format=settings.log_fmt, level=logging.INFO): logging.Handler.__init__(self) # Initialize a log handler as the super class self.setFormatter(logging.Formatter(format)) # Set the formatter for the logger self.setLevel(level) # Set the logging level self.frame = QFrame(parent) # Initialize a QFrame to place other widgets in self.frame2 = QFrame(parent) # Initialize frame2 for the label and checkbox self.label = QLabel('Logs') # Define a label for the frame self.check = QCheckBox('Debugging') # Checkbox to enable debugging logging self.check.clicked.connect(self.__changeLevel) # Connect checkbox clicked to the __changeLevel method self.log_widget = QTextEdit() # Initialize a QPlainTextWidget to write logs to self.log_widget.verticalScrollBar().minimum() # Set a vertical scroll bar on the log widget self.log_widget.horizontalScrollBar().minimum() # Set a horizontal scroll bar on the log widget self.log_widget.setLineWrapMode(self.log_widget.NoWrap) # Set line wrap mode to no wrapping self.log_widget.setFont(QFont("Courier", 12)) # Set the font to a monospaced font self.log_widget.setReadOnly(True) # Set log widget to read only layout = QHBoxLayout() # Initialize a horizontal layout scheme for the label and checkbox frame layout.addWidget(self.label) # Add the label to the layout scheme layout.addWidget(self.check) # Add the checkbox to the layout scheme self.frame2.setLayout(layout) # Set the layout for frame to the horizontal layout layout = QVBoxLayout() # Initialize a layout scheme for the widgets layout.addWidget(self.frame2) # Add the label/checkbox frame to the layout scheme layout.addWidget(self.log_widget) # Add the text widget to the layout scheme self.frame.setLayout(layout)
def __init__(self): QFrame.__init__(self) layout = QGridLayout() self.btnMonitor1 = OutputButton(ID=2) self.btnMonitor1.setText("Monitor 1") layout.addWidget(self.btnMonitor1, 0, 1) self.btnChurch = OutputButton(ID=4) self.btnChurch.setText("Church") layout.addWidget(self.btnChurch, 1, 0) self.btnSpecial = OutputButton(ID=7) self.btnSpecial.setText("Stage") layout.addWidget(self.btnSpecial, 1, 1) self.btnGallery = OutputButton(ID=6) self.btnGallery.setText("Gallery") layout.addWidget(self.btnGallery, 2, 0) self.btnWelcome = OutputButton(ID=5) self.btnWelcome.setText("Welcome") layout.addWidget(self.btnWelcome, 2, 1) self.btnFont = OutputButton(ID=3) self.btnFont.setText("Font") layout.addWidget(self.btnFont, 3, 0) self.btnRecord = OutputButton(ID=8) self.btnRecord.setText("Record") layout.addWidget(self.btnRecord, 3, 1) self.btnPCMix = OutputButton(ID=2) self.btnPCMix.setText("PC Mix") layout.addWidget(self.btnPCMix, 4, 0) self.btnAll = IDedButton(ID=0) self.btnAll.setText("All") layout.addWidget(self.btnAll, 4, 1) self.outputButtons = { 2: self.btnMonitor1, 3: self.btnFont, 4: self.btnChurch, 5: self.btnWelcome, 6: self.btnGallery, 7: self.btnSpecial, 8: self.btnRecord, } layout.setColumnMinimumWidth(0, 100) layout.setColumnMinimumWidth(1, 100) layout.setColumnStretch(0, 1) layout.setColumnStretch(1, 1) self.setLayout(layout)
def __init__(self, parent=None): """ Initialize the Transaction Menu Widget """ QFrame.__init__(self, parent=parent) self.setFrameShape(QFrame.Panel) self.layout = QVBoxLayout(self) self.transaction = None self.forms = [SubtransactionForm(self)] self.setupHeader() for form in self.forms: form.setup() self.layout.addStretch()
def _init_settings_tab(self, tab): oneactive_checkbox = QCheckBox("Keep at most one active path") oneactive_checkbox.setChecked(False) self._oneactive_checkbox = oneactive_checkbox settings_layout = QVBoxLayout() settings_layout.addWidget(oneactive_checkbox) settings_layout.addStretch(0) frame = QFrame() frame.setLayout(settings_layout) tab.addTab(frame, 'Settings')
def __init__(self, *args, **kwargs ): QDialog.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.setWindowTitle( Window.title ) mainLayout = QVBoxLayout( self ) sep1 = QFrame();sep1.setFrameShape(QFrame.HLine) sep2 = QFrame();sep2.setFrameShape(QFrame.HLine) sep3 = QFrame();sep3.setFrameShape(QFrame.HLine) hl_loadVtx = QHBoxLayout(); hl_loadVtx.setSpacing(5) w_loadVtx_src = Widget_LoadVertex( title="Source Root Vertex" ) w_loadVtx_trg = Widget_LoadVertex( title="Target Root Vertex" ) hl_loadVtx.addWidget( w_loadVtx_src ) hl_loadVtx.addWidget( w_loadVtx_trg ) hl_loadJoints = QHBoxLayout(); hl_loadJoints.setSpacing(5) w_loadJoints_src = Widget_loadJoints("Source Joints") w_loadJoints_trg = Widget_loadJoints("Target Joints") w_loadJoints_src.otherWidget = w_loadJoints_trg;w_loadJoints_trg.otherWidget = w_loadJoints_src; hl_loadJoints.addWidget( w_loadJoints_src ) hl_loadJoints.addWidget( w_loadJoints_trg ) w_selectionGrow = Widget_SelectionGrow() hl_select = QHBoxLayout(); hl_select.setSpacing(5) b_selectSrc = QPushButton( "Select Source Vertices" ) b_selectTrg = QPushButton( "Select Target Vertices" ) hl_select.addWidget( b_selectSrc ) hl_select.addWidget( b_selectTrg ) b_copyWeight = QPushButton( "Copy Weight" ) mainLayout.addLayout( hl_loadVtx ) mainLayout.addWidget( sep1 ) mainLayout.addLayout( hl_loadJoints ) mainLayout.addWidget( sep2 ) mainLayout.addWidget( w_selectionGrow ) mainLayout.addLayout( hl_select ) mainLayout.addWidget( sep3 ) mainLayout.addWidget( b_copyWeight ) self.resize( Window.defaultWidth, Window.defaultHeight ) self.li_sourceVertex = w_loadVtx_src.lineEdit self.li_targetVertex = w_loadVtx_trg.lineEdit self.li_numGrow = w_selectionGrow.lineEdit self.lw_srcJoints = w_loadJoints_src.listWidget self.lw_trgJoints = w_loadJoints_trg.listWidget QtCore.QObject.connect( b_selectSrc, QtCore.SIGNAL( "clicked()" ), self.selectSourceVertices ) QtCore.QObject.connect( b_selectTrg, QtCore.SIGNAL( "clicked()" ), self.selectTargetVertices ) QtCore.QObject.connect( b_copyWeight, QtCore.SIGNAL( 'clicked()' ), self.copyWeight )
def BorderBox(self, layout): from PySide.QtGui import QFrame toto = QFrame() toto.setLayout(layout) toto.setFrameShape(QFrame.Box) toto.setFrameShadow(QFrame.Sunken) return toto
def __init__(self, parent, level, levelSelection): """ Initialize the Level Overview View """ QFrame.__init__(self, parent) self.resize(self.WIDTH, self.HEIGHT) self.level = level self.levelSelection = levelSelection self.bigFont = QFont() self.bigFont.setPointSize(32) self.smallFont = QFont() self.smallFont.setPointSize(24) self.label = self.getLabel(self.smallFont)
def __init__(self, parent, level): """ Initialize the Level View """ QFrame.__init__(self, parent) self.resize(640, 480) self.level = level self.minefield_view = MinefieldView(self.level.minefield, self.level.drone, self) self.levelCompletionView = LevelCompletionView(self.level, self.minefield_view.getWidth(), 480-self.minefield_view.getHeight(), self) self.levelCompletionView.move(0, self.minefield_view.getHeight()) self.gameStatusBar = GameStatusView(level, 640-self.minefield_view.getWidth(), 480, parent=self) self.gameStatusBar.move(self.minefield_view.getWidth(), 0) self.setFocusPolicy(Qt.StrongFocus)
def setup(self): """ Setup the Subtransactions for the Transaction Details """ self.subtransactionFrame = QFrame() self.verticalLayout = QVBoxLayout(self.subtransactionFrame) self.horizontalLayout = QHBoxLayout() label = QLabel("<b>Subtransactions</b>") self.horizontalLayout.addWidget(label) button = QPushButton("Add New Subtransaction") button.clicked.connect(self.addSubtransaction) self.horizontalLayout.addWidget(button) self.removeButton = QPushButton("Remove Subtransaction") self.removeButton.clicked.connect(self.removeSubtransaction) self.horizontalLayout.addWidget(self.removeButton) self.removeButton.setEnabled(False) self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.addWidget(self.subtransactionTable) self.verticalLayout.addStretch() self.subtransactionFrame.setLayout(self.verticalLayout) self.layout.addWidget(self.subtransactionFrame)
def __init__(self, minefield, drone, parent=None): """ Initialize the grid square view """ QFrame.__init__(self, parent) self.minefield = minefield self.drone = drone self.minefield_grid = MinefieldGridView(minefield, drone, parent=self) self.borderWidth = GridSquareFrame.GRID_SQUARE_SIZE / 2 self.borderHeight = GridSquareFrame.GRID_SQUARE_SIZE / 2 self.setup() self.color = QColor(200, 200, 200) #self.setStyleSheet("QFrame { background-color: rgba(200, 200, 200, 100%) }") self.resize(self.getWidth(), self.getHeight()) self.minefield_grid.move(self.borderWidth, self.borderHeight)
def __init__(self, minefield, drone, parent=None): """ Initialize the grid square view """ QFrame.__init__(self, parent) self.minefield = minefield self.drone = drone self.minefield_grid = MinefieldGridView(minefield, drone, parent=self) self.borderWidth = GridSquareFrame.GRID_SQUARE_SIZE/2 self.borderHeight = GridSquareFrame.GRID_SQUARE_SIZE/2 self.setup() self.color = QColor(200, 200, 200) #self.setStyleSheet("QFrame { background-color: rgba(200, 200, 200, 100%) }") self.resize(self.getWidth(), self.getHeight()) self.minefield_grid.move(self.borderWidth, self.borderHeight)
def __init__(self, parent, app, widget, on_change): """Init and connect signals""" self.parent = parent self.app = app self.widget = widget self.note = None self.on_change = on_change self._resource_labels = {} self._resources = [] self._res_hash = {} frame = QFrame() frame.setLayout(QVBoxLayout()) frame.setFixedWidth(100) self.widget.setFixedWidth(100) self.widget.setWidget(frame) self.widget.hide() self.mime = magic.open(magic.MIME_TYPE) self.mime.load()
def __init__(self, parent = None): super(MainWindow, self).__init__(parent) self.app = app = QCoreApplication.instance() self.setWindowTitle('Button Size Test') self.stupidSize = 3 self.dummyWidget = QFrame() self.dummyWidget.setFrameStyle(QFrame.Box) self.organizeContent(self.dummyWidget) self.setCentralWidget(self.dummyWidget)
def setLogo(self): """Sets the company logo in the same place in all views""" logoPixmap = QPixmap(':/resources/logo.png') self.iconLabel = QLabel(self) self.iconLabel.setPixmap(logoPixmap) self.iconLabel.setGeometry(20, 20, logoPixmap.width(), logoPixmap.height()) self.linkLabel = QLabel(self) self.linkLabel.setText( """<font size="1"><a href="http://www.iqstorage.com/fromiqbox.php"> Developed at IQ Storage FTP Hosing Services</a></font>""") self.linkLabel.setOpenExternalLinks(True) # Defines a visual line separator to be placed under the `logoPixmap` `QLabel` self.line = QFrame() self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken)
def __init__(self, levelSelection, parent=None): """ Initialize the Level Details View """ QFrame.__init__(self, parent) #self.resize(self.WIDTH, self.HEIGHT) self.levelSelection = levelSelection self.smallFont = QFont() self.smallFont.setPointSize(14) self.bigFont = QFont() self.bigFont.setPointSize(24) self.detailsLabel = self.getLabel("Level Details", self.bigFont, alignment=Qt.AlignCenter) self.detailsLabel.move(32, 16) self.setupGridLabel() self.setupDefensesLabels() self.setupRatingsLabel()
def __init__(self, parent, remote_documents_service): super(NonconformitiesWidget, self).__init__(parent) self._track_changes = True self._current_qe = None self._change_tracker = ChangeTracker(Base) self.order_part_id = None self.quality_events = InstrumentedRelation() top_layout = QVBoxLayout() top_layout.addWidget(QLabel(u"<h3>{}</h3>".format( _("Non conformity")))) control_layout = QHBoxLayout() self.quality_issue_chooser = QComboBox(self) # self.quality_issue_chooser.addItems(["a","b"]) # self.quality_issue_chooser.activated.connect(self.set_quality_issue) self.quality_issue_chooser.currentIndexChanged.connect( self.set_quality_issue) self.add_quality_issue_button = QPushButton(_("Add")) self.remove_quality_issue_button = QPushButton(_("Remove")) self.add_quality_issue_button.clicked.connect(self.add_quality_issue) self.remove_quality_issue_button.clicked.connect( self.remove_quality_issue) control_layout.addWidget(self.quality_issue_chooser) control_layout.addWidget(self.add_quality_issue_button) control_layout.addWidget(self.remove_quality_issue_button) control_layout.setStretch(0, 1) top_layout.addLayout(control_layout) horizontalLine = QFrame(self) horizontalLine.setFrameStyle(QFrame.HLine) # horizontalLine.setMinimumHeight(1) # seems useless # horizontalLine.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Minimum) # seems useless top_layout.addWidget(horizontalLine) self.nc_edit = Nonconformity2Widget(self, remote_documents_service) self.nc_edit.issue_changed.connect(self._issue_edited_slot) top_layout.addWidget(self.nc_edit) self.setLayout(top_layout)
def init_msh_ui(self): comps = QGroupBox('Components') mdlgr = QGroupBox('Models - {0}'.format(self.mdlmanager.count())) mdllay = QVBoxLayout() mdllay.addWidget(self.mdlmanager.get_frame()) #mdllay.addStretch() mdlgr.setLayout(mdllay) matgr = QGroupBox('Materials - {0}'.format(self.matmanager.count())) matlay = QVBoxLayout() matlay.addWidget(self.matmanager.get_frame()) #matlay.addStretch() matgr.setLayout(matlay) frame2lay = QHBoxLayout() frame2lay.addWidget(matgr) frame2lay.addWidget(mdlgr) comps.setLayout(frame2lay) # Misc stuff. self.setGeometry(200, 100, WIDTH_MSH, HEIGHT_MSH) frame = QFrame() framelay = QVBoxLayout() framelay.addWidget(self.infomanager.get_frame()) framelay.addWidget(comps) #framelay.addStretch() load = QPushButton('Open') load.clicked.connect(self.load_msh) save = QPushButton('Save') save.clicked.connect(self.save) close = QPushButton('Close') close.clicked.connect(self.close) btnlay = QHBoxLayout() btnlay.addWidget(QLabel('<b>MSH Suite</b> Version {0}'.format(SUITE_VER))) btnlay.addStretch() btnlay.addWidget(load) btnlay.addWidget(save) btnlay.addWidget(close) framelay.addLayout(btnlay) frame.setLayout(framelay) self.setCentralWidget(frame) self.setWindowTitle('MSH Suite - {0}'.format(self.msh.info.name))
def _load_tmps(self): state = self._state layout = QVBoxLayout() self._tmps.clear() if state is None: tmps = {} else: tmps = state.scratch.temps # tmps for tmp_id, tmp_value in tmps.iteritems(): sublayout = QHBoxLayout() lbl_tmp_name = QLabel(self) lbl_tmp_name.setProperty('class', 'reg_viewer_label') lbl_tmp_name.setText("tmp_%d" % tmp_id) lbl_tmp_name.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sublayout.addWidget(lbl_tmp_name) sublayout.addSpacing(10) tmp_viewer = QASTViewer(tmp_value, parent=self) self._tmps[tmp_id] = tmp_viewer sublayout.addWidget(tmp_viewer) layout.addLayout(sublayout) layout.setSpacing(0) layout.addStretch(0) layout.setContentsMargins(2, 2, 2, 2) # the container container = QFrame() container.setAutoFillBackground(True) palette = container.palette() palette.setColor(container.backgroundRole(), Qt.white) container.setPalette(palette) container.setLayout(layout) self._area.setWidget(container)
def _view_server(kwargs, queue): from PySide.QtGui import QApplication, QMainWindow, QFrame, QGridLayout from RubikView import RubikView # Grab the partition to view from the queue. app = QApplication(sys.argv) frame = QFrame() layout = QGridLayout() frame.setLayout(layout) mainwindow = QMainWindow() mainwindow.setCentralWidget(frame) mainwindow.resize(1024, 768) mainwindow.move(30, 30) # Find next highest square number and fill within that shape partitions = queue.get() side = math.ceil(math.sqrt(len(partitions))) aspect = (side, side) views = [] for i, partition in enumerate(partitions): rview = RubikView(mainwindow) if "renderer" in kwargs: rview.set_face_renderer(kwargs["renderer"]) else: rview.set_face_renderer(colored_face_renderer(**kwargs)) rview.set_partition(partition) r, c = np.unravel_index(i, aspect) layout.addWidget(rview, r, c) views.append(rview) mainwindow.show() mainwindow.raise_() rotation = kwargs.get("rotation", (45, 3, 3, 1)) for rview in views: rview.set_rotation_quaternion(*rotation) app.exec_()
def setup_thresh_buttons(self): ''' set up buttons for overlay/clearing thresh view ''' self.button_frame = QFrame(self) self.button_frame.setGeometry( QRect(self.window_width * .52, self.window_height * .13 + self.video_height, self.video_width * .98, 50)) button_layout = QHBoxLayout() self.button_frame.setLayout(button_layout) self.clear_button = QPushButton('Clear') self.overlay_button = QPushButton('Overlay') button_layout.addWidget(self.clear_button) button_layout.addWidget(self.overlay_button) self.clear_button.setEnabled(False) self.clear_button.clicked.connect(self.clear_threshed) self.overlay_button.setEnabled(False) self.overlay_button.clicked.connect(self.overlay_threshed)
def _init_cfg_options_tab(self, tab): resolve_indirect_jumps = QCheckBox(self) resolve_indirect_jumps.setText('Resolve indirect jumps') resolve_indirect_jumps.setChecked(True) self.option_widgets['resolve_indirect_jumps'] = resolve_indirect_jumps collect_data_refs = QCheckBox(self) collect_data_refs.setText( 'Collect cross-references and infer data types') collect_data_refs.setChecked(True) self.option_widgets['collect_data_refs'] = collect_data_refs layout = QVBoxLayout() layout.addWidget(resolve_indirect_jumps) layout.addWidget(collect_data_refs) layout.addStretch(0) frame = QFrame(self) frame.setLayout(layout) tab.addTab(frame, 'CFG Options')
def new_tab(self): """Open new tab.""" tasklist = QTreeView() tasklist.hide() tasklist.setObjectName('taskList') tasklist.setMinimumWidth(100) tasklist.setMaximumWidth(250) new_tab = QWebView() new_tab.setObjectName('webView') inspector = QWebInspector(self) inspector.setObjectName('webInspector') inspector.hide() page_layout = QVBoxLayout() page_layout.setSpacing(0) page_layout.setContentsMargins(0, 0, 0, 0) page_layout.addWidget(new_tab) page_layout.addWidget(inspector) page_widget = QFrame() page_widget.setObjectName('pageWidget') page_widget.setLayout(page_layout) complete_tab_layout = QHBoxLayout() complete_tab_layout.setSpacing(0) complete_tab_layout.setContentsMargins(0, 0, 0, 0) complete_tab_layout.addWidget(tasklist) complete_tab_layout.addWidget(page_widget) complete_tab_widget = QFrame() complete_tab_widget.setLayout(complete_tab_layout) new_tab.load(QUrl(self.startpage)) self.tabs.setUpdatesEnabled(False) if self.new_tab_behavior == "insert": self.tabs.insertTab(self.tabs.currentIndex()+1, complete_tab_widget, unicode(new_tab.title())) elif self.new_tab_behavior == "append": self.tabs.appendTab(complete_tab_widget, unicode(new_tab.title())) self.tabs.setCurrentWidget(complete_tab_widget) self.tabs.setTabText(self.tabs.currentIndex(), unicode(self.tabs.currentWidget().findChild(QFrame, unicode('pageWidget')).findChild(QWebView, unicode('webView')).title())) self.tabs.setUpdatesEnabled(True) # tab.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) # tab.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) new_tab.titleChanged.connect(self.change_tab) new_tab.urlChanged.connect(self.change_tab) new_tab.loadStarted.connect(self.load_start) new_tab.loadFinished.connect(self.load_finish) new_tab.loadProgress.connect(self.pbar.setValue) new_tab.page().linkHovered.connect(self.linkHover) inspector.setPage(new_tab.page())
def __init__(self, options, parent=None): _OptionsWizardPage.__init__(self, options, parent=parent) self.setTitle("Conversion warnings") # Widgets self._lbl_count = SimulationCountLabel() self._lbl_count.setAlignment(Qt.AlignCenter) # Layouts layout = self.layout() frm_line = QFrame() frm_line.setFrameStyle(QFrame.HLine) frm_line.setFrameShadow(QFrame.Sunken) layout.addWidget(frm_line) sublayout = QHBoxLayout() sublayout.setContentsMargins(10, 0, 10, 0) sublayout.addWidget(self._lbl_count) layout.addLayout(sublayout)
def _load_memory_widgets(self): state = self._state COLUMNS = 16 ROWS = 10 layout = QVBoxLayout() addr_base = self.addr for row in xrange(ROWS): row_layout = QHBoxLayout() col = 0 addr = addr_base + row * COLUMNS addr_label = QLabel("%x" % addr) addr_label.setProperty("class", "memory_viewer_address") row_layout.addWidget(addr_label) while col < COLUMNS: addr = addr_base + row * COLUMNS + col data = state.memory.load(addr, 1) ast_viewer = QASTViewer(data, display_size=False, byte_format="%02x") row_layout.addWidget(ast_viewer) col += 1 row_layout.addStretch(0) layout.addLayout(row_layout) container = QFrame() container.setLayout(layout) self._scrollarea.setWidget(container)
def initUI(self): open_msh_btn = QPushButton('Open .MSH...') open_msh_btn.clicked.connect(self.load_msh) open_msh_btn.setToolTip('<b>Loads a .MSH file</b> for editing.') dump_msh_btn = QPushButton('Dump .MSH...') dump_msh_btn.clicked.connect(self.dump_msh) dump_msh_btn.setToolTip('<b>Dumps .MSH file information</b> into a text file.') munge_anim_btn = QPushButton('Munge Animation') munge_anim_btn.clicked.connect(self.munge_anim) munge_anim_btn.setToolTip('<b>Launches the AnimMunger.</b>') buttonslay = QGridLayout() buttonslay.addWidget(open_msh_btn, 1, 1) buttonslay.addWidget(dump_msh_btn, 1, 3) buttonslay.addWidget(munge_anim_btn, 3, 1) frame = QFrame() frame.setLayout(buttonslay) self.setCentralWidget(frame) self.setGeometry(200, 100, WIDTH_LAUNCH, HEIGHT_LAUNCH) self.setWindowTitle('MSH Suite') self.show()
def __init__(self, parent=None): QFrame.__init__(self, parent) self.log = logging.getLogger(__name__) self.year = QLineEdit() self.month = QLineEdit() self.day = QLineEdit() self.hour = QLineEdit() year = QLabel('Year') month = QLabel('Month') day = QLabel('Day') hour = QLabel('Hour') grid = QGridLayout() grid.addWidget(year, 0, 0) grid.addWidget(month, 0, 1) grid.addWidget(day, 0, 2) grid.addWidget(hour, 0, 3) grid.addWidget(self.year, 1, 0) grid.addWidget(self.month, 1, 1) grid.addWidget(self.day, 1, 2) grid.addWidget(self.hour, 1, 3) self.setLayout(grid)
def __init__(self): QFrame.__init__(self) self._color = [220, 220, 220] self._font = QFont() self._font.setPixelSize(10) self._pen = QPen(QColor(100, 100, 100, 255)) self.label = QLabel() self.label.setWordWrap(True) self.label.setFont(self._font) self.label.setMaximumWidth(300) self.label.setMaximumHeight(36) self.label.setMinimumHeight(36) layout = QGridLayout() layout.setSpacing(0) layout.addWidget(self.label) self.setLayout(layout) self.setMinimumWidth(360) self.setMaximumWidth(360)
def setupUI(self): paneLayout = QHBoxLayout() paneLayout.setContentsMargins(0, 0, 0, 0) leftPane = QFrame() leftPane.setObjectName("leftPane") leftPaneLayout = QVBoxLayout() leftPaneLayout.setContentsMargins(20, 20, 20, 10) heading = QLabel("Select Employee: ") heading.setObjectName("heading") leftPaneLayout.addWidget(heading) leftPaneLayout.addSpacing(10) form1 = QFormLayout() form1.addRow(QLabel("Name"), self.nameSearch) form1.addRow(QLabel("ID No."), self.id) leftPaneLayout.addLayout(form1) leftPaneLayout.addStretch() leftPane.setLayout(leftPaneLayout) layout = QVBoxLayout() layout.setContentsMargins(20, 20, 20, 10) editGroup = QGroupBox("Edit below") form = QFormLayout() form.setContentsMargins(10, 10, 10, 30) form.setSpacing(20) form.addRow(QLabel("Name"), self.nameEdit) form.addRow(QLabel("Designation"), self.designation) form.addRow(QLabel("Original Pay"), self.originalPay) form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade) form.addRow(QLabel("Date of joining"), self.DOJ) form.addRow(QLabel("Pan No."), self.pan) editGroup.setLayout(form) layout.addWidget(editGroup) layout.addStretch() bttnLayout = QHBoxLayout() bttnLayout.addStretch() bttnLayout.addWidget(self.bttnCancel) bttnLayout.addWidget(self.bttnSave) layout.addLayout(bttnLayout) paneLayout.addWidget(leftPane) paneLayout.addLayout(layout) self.setLayout(paneLayout)