def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtVersion = QLineEdit() form.addRow(self.tr("Plugin Name:"), self._txtName) form.addRow(self.tr("Plugin Version:"), self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._btnFilePath = QPushButton(QIcon(":img/open"), '') hPath.addWidget(QLabel(self.tr("Plugin File:"))) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem(QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(self.tr("Install")) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) #Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def changeTileWidth(): '''Change tile width (tile block size) and reset image-scene''' dlg = QDialog(self) dlg.setWindowTitle("Viewer Tile Width") dlg.setModal(True) spinBox = QSpinBox( parent=dlg ) spinBox.setRange( 128, 10*1024 ) spinBox.setValue( self.editor.imageScenes[0].tileWidth() ) ctrl_layout = QHBoxLayout() ctrl_layout.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding)) ctrl_layout.addWidget( QLabel("Tile Width:") ) ctrl_layout.addWidget( spinBox ) button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, parent=dlg) button_box.accepted.connect( dlg.accept ) button_box.rejected.connect( dlg.reject ) dlg_layout = QVBoxLayout() dlg_layout.addLayout( ctrl_layout ) dlg_layout.addWidget( QLabel("Setting will apply current view immediately,\n" "and all other views upon restart.") ) dlg_layout.addWidget( button_box ) dlg.setLayout( dlg_layout ) if dlg.exec_() == QDialog.Accepted: for s in self.editor.imageScenes: if s.tileWidth != spinBox.value(): s.setTileWidth( spinBox.value() ) s.reset()
def __createLayout(self): " Creates the widget layout " verticalLayout = QVBoxLayout(self) verticalLayout.setContentsMargins(0, 0, 0, 0) verticalLayout.setSpacing(0) self.headerFrame = QFrame() self.headerFrame.setFrameStyle(QFrame.StyledPanel) self.headerFrame.setAutoFillBackground(True) headerPalette = self.headerFrame.palette() headerBackground = headerPalette.color(QPalette.Background) headerBackground.setRgb(min(headerBackground.red() + 30, 255), min(headerBackground.green() + 30, 255), min(headerBackground.blue() + 30, 255)) headerPalette.setColor(QPalette.Background, headerBackground) self.headerFrame.setPalette(headerPalette) self.headerFrame.setFixedHeight(24) self.__threadsLabel = QLabel("Threads") expandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) fixedSpacer = QSpacerItem(3, 3) self.__showHideButton = QToolButton() self.__showHideButton.setAutoRaise(True) self.__showHideButton.setIcon(PixmapCache().getIcon('less.png')) self.__showHideButton.setFixedSize(20, 20) self.__showHideButton.setToolTip("Hide threads list") self.__showHideButton.setFocusPolicy(Qt.NoFocus) self.__showHideButton.clicked.connect(self.__onShowHide) headerLayout = QHBoxLayout() headerLayout.setContentsMargins(0, 0, 0, 0) headerLayout.addSpacerItem(fixedSpacer) headerLayout.addWidget(self.__threadsLabel) headerLayout.addSpacerItem(expandingSpacer) headerLayout.addWidget(self.__showHideButton) self.headerFrame.setLayout(headerLayout) self.__threadsList = QTreeWidget() self.__threadsList.setSortingEnabled(False) # I might not need that because of two reasons: # - the window has no focus # - the window has custom current indicator # self.__threadsList.setAlternatingRowColors( True ) self.__threadsList.setRootIsDecorated(False) self.__threadsList.setItemsExpandable(False) self.__threadsList.setUniformRowHeights(True) self.__threadsList.setSelectionMode(QAbstractItemView.NoSelection) self.__threadsList.setSelectionBehavior(QAbstractItemView.SelectRows) self.__threadsList.setItemDelegate(NoOutlineHeightDelegate(4)) self.__threadsList.setFocusPolicy(Qt.NoFocus) self.__threadsList.itemClicked.connect(self.__onThreadClicked) self.__threadsList.setHeaderLabels(["", "Name", "State", "TID"]) verticalLayout.addWidget(self.headerFrame) verticalLayout.addWidget(self.__threadsList) return
def __init__(self, parent=None): super(MigrationWidget, self).__init__(parent, Qt.WindowStaysOnTopHint) self._migration = {} vbox = QVBoxLayout(self) lbl_title = QLabel(self.tr("Current code:")) self.current_list = QListWidget() lbl_suggestion = QLabel(self.tr("Suggested changes:")) self.suggestion = QPlainTextEdit() self.suggestion.setReadOnly(True) self.btn_apply = QPushButton(self.tr("Apply change!")) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(self.btn_apply) vbox.addWidget(lbl_title) vbox.addWidget(self.current_list) vbox.addWidget(lbl_suggestion) vbox.addWidget(self.suggestion) vbox.addLayout(hbox) self.connect(self.current_list, SIGNAL("itemClicked(QListWidgetItem*)"), self.load_suggestion) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes) IDE.register_service('tab_migration', self) ExplorerContainer.register_tab(translations.TR_TAB_MIGRATION, self)
def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle(self.tr("Themes Manager")) self.resize(700, 500) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) # Footer hbox = QHBoxLayout() btn_close = QPushButton(self.tr('Close')) btnReload = QPushButton(self.tr("Reload")) hbox.addWidget(btn_close) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnReload) vbox.addLayout(hbox) self.overlay = ui_tools.Overlay(self) self.overlay.show() self._schemes = [] self._loading = True self.downloadItems = [] #Load Themes with Thread self.connect(btnReload, SIGNAL("clicked()"), self._reload_themes) self._thread = ui_tools.ThreadExecution(self.execute_thread) self.connect(self._thread, SIGNAL("finished()"), self.load_skins_data) self.connect(btn_close, SIGNAL('clicked()'), self.close) self._reload_themes()
def __init__(self, parent): QDialog.__init__(self, parent, Qt.WindowMinMaxButtonsHint) self.clicks = 0 self.setWindowTitle(self.tr("Acerca de Edis")) self.setMinimumWidth(485) box = QVBoxLayout(self) self.label_logo = QLabel() self.label_logo.setPixmap(QPixmap(":image/edis")) title_label = QLabel( self.tr("<h1>Edis</h1>\n<i>a simple " "cross-platform IDE for C</i>")) title_label.setAlignment(Qt.AlignRight) box_logo = QHBoxLayout() box_logo.addWidget(self.label_logo) box_logo.addWidget(title_label) box.addLayout(box_logo) lbl_version = QLabel( self.tr("<b>Versión:</b> {0}").format(ui.__version__)) box.addWidget(lbl_version) http = "http://" lbl_link = QLabel("<b>Web:</b> <a href='%s'><span style='color: " "#626655;'>%s</span></a>" % (ui.__web__, ui.__web__.replace(http, ""))) lbl_sc = QLabel( self.tr("<b>Código fuente:</b> <a href='{0}'><span" " style='color: #626655;'>{1}</span></a>").format( ui.__source_code__, ui.__source_code__.replace(http, ""))) box.addWidget(lbl_link) box.addWidget(lbl_sc) # License box.addWidget( QLabel( self.tr("<b>Licencia:</b> <i>Edis</i> se " "distribuye bajo los términos de la " "licencia <b>GPLv3+</b>"))) box.addWidget( QLabel(self.tr("<b>Autor:</b> {0}").format(ui.__author__))) box.addWidget( QLabel(self.tr("<b>e-mail:</b> {0}").format(ui.__email_author__))) # Thanks to lbl_contributors = QLabel( self.tr("Agradezco a los que <a href=" "{0}><span style='color: #626655;'>" "contribuyeron</span></a> con Edis").format( ui.__contributors__)) box.addWidget(lbl_contributors) box_boton = QHBoxLayout() box_boton.addSpacerItem(QSpacerItem(0, 10, QSizePolicy.Expanding)) btn_ok = QPushButton(self.tr("Aceptar")) box_boton.addWidget(btn_ok) box.addLayout(box_boton) # Conexiones btn_ok.clicked.connect(self.close) lbl_link.linkActivated['QString'].connect(self._open_link) lbl_sc.linkActivated['QString'].connect(self._open_link) lbl_contributors.linkActivated['QString'].connect(self._open_link) self.label_logo.installEventFilter(self)
def initMainUi(self): role_names = self.parentApplet.dataSelectionApplet.topLevelOperator.DatasetRoles.value self.list_widgets = [] # Create a tab for each role for role_index, role_name in enumerate(role_names): select_button = QPushButton("Select " + role_name + " Files...", clicked=partial(self.select_files, role_index) ) clear_button = QPushButton("Clear " + role_name + " Files", clicked=partial(self.clear_files, role_index) ) button_layout = QHBoxLayout() button_layout.addWidget(select_button) button_layout.addSpacerItem( QSpacerItem(0,0,hPolicy=QSizePolicy.Expanding) ) button_layout.addWidget(clear_button) button_layout.setContentsMargins(0, 0, 0, 0) button_layout_widget = QWidget() button_layout_widget.setLayout(button_layout) button_layout_widget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) ) list_widget = QListWidget(parent=self) list_widget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) ) self.list_widgets.append( list_widget ) tab_layout = QVBoxLayout() tab_layout.setContentsMargins(0, 0, 0, 0) tab_layout.addWidget( button_layout_widget ) tab_layout.addWidget( list_widget ) layout_widget = QWidget(parent=self) layout_widget.setLayout(tab_layout) self.addTab(layout_widget, role_name)
def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtVersion = QLineEdit() form.addRow(self.tr("Plugin Name:"), self._txtName) form.addRow(self.tr("Plugin Version:"), self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._btnFilePath = QPushButton(QIcon(":img/open"), '') hPath.addWidget(QLabel(self.tr("Plugin File:"))) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem( QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(self.tr("Install")) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) #Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def __init__(self): super(MigrationWidget, self).__init__() self._migration = {} vbox = QVBoxLayout(self) lbl_title = QLabel(self.tr("Current code:")) self.current_list = QListWidget() lbl_suggestion = QLabel(self.tr("Suggested changes:")) self.suggestion = QPlainTextEdit() self.suggestion.setReadOnly(True) self.btn_apply = QPushButton(self.tr("Apply change!")) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(self.btn_apply) vbox.addWidget(lbl_title) vbox.addWidget(self.current_list) vbox.addWidget(lbl_suggestion) vbox.addWidget(self.suggestion) vbox.addLayout(hbox) self.connect(self.current_list, SIGNAL("itemClicked(QListWidgetItem*)"), self.load_suggestion) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes)
def __createLayout( self ): " Creates the widget layout " verticalLayout = QVBoxLayout( self ) verticalLayout.setContentsMargins( 0, 0, 0, 0 ) verticalLayout.setSpacing( 0 ) self.headerFrame = QFrame() self.headerFrame.setFrameStyle( QFrame.StyledPanel ) self.headerFrame.setAutoFillBackground( True ) headerPalette = self.headerFrame.palette() headerBackground = headerPalette.color( QPalette.Background ) headerBackground.setRgb( min( headerBackground.red() + 30, 255 ), min( headerBackground.green() + 30, 255 ), min( headerBackground.blue() + 30, 255 ) ) headerPalette.setColor( QPalette.Background, headerBackground ) self.headerFrame.setPalette( headerPalette ) self.headerFrame.setFixedHeight( 24 ) self.__threadsLabel = QLabel( "Threads" ) expandingSpacer = QSpacerItem( 10, 10, QSizePolicy.Expanding ) fixedSpacer = QSpacerItem( 3, 3 ) self.__showHideButton = QToolButton() self.__showHideButton.setAutoRaise( True ) self.__showHideButton.setIcon( PixmapCache().getIcon( 'less.png' ) ) self.__showHideButton.setFixedSize( 20, 20 ) self.__showHideButton.setToolTip( "Hide threads list" ) self.__showHideButton.setFocusPolicy( Qt.NoFocus ) self.__showHideButton.clicked.connect( self.__onShowHide ) headerLayout = QHBoxLayout() headerLayout.setContentsMargins( 0, 0, 0, 0 ) headerLayout.addSpacerItem( fixedSpacer ) headerLayout.addWidget( self.__threadsLabel ) headerLayout.addSpacerItem( expandingSpacer ) headerLayout.addWidget( self.__showHideButton ) self.headerFrame.setLayout( headerLayout ) self.__threadsList = QTreeWidget() self.__threadsList.setSortingEnabled( False ) # I might not need that because of two reasons: # - the window has no focus # - the window has custom current indicator # self.__threadsList.setAlternatingRowColors( True ) self.__threadsList.setRootIsDecorated( False ) self.__threadsList.setItemsExpandable( False ) self.__threadsList.setUniformRowHeights( True ) self.__threadsList.setSelectionMode( QAbstractItemView.NoSelection ) self.__threadsList.setSelectionBehavior( QAbstractItemView.SelectRows ) self.__threadsList.setItemDelegate( NoOutlineHeightDelegate( 4 ) ) self.__threadsList.setFocusPolicy( Qt.NoFocus ) self.__threadsList.itemClicked.connect( self.__onThreadClicked ) self.__threadsList.setHeaderLabels( [ "", "Name", "State", "TID" ] ) verticalLayout.addWidget( self.headerFrame ) verticalLayout.addWidget( self.__threadsList ) return
def __init__(self, parent=None): super(NewProjectManager, self).__init__(parent, Qt.Dialog) self.setWindowTitle(translations.TR_NEW_PROJECT) self.setMinimumHeight(500) vbox = QVBoxLayout(self) vbox.addWidget(QLabel(translations.TR_CHOOSE_TEMPLATE)) vbox.addWidget(QLabel(translations.TR_TAB_PROJECTS)) hbox = QHBoxLayout() self.list_projects = QListWidget() self.list_projects.setProperty("wizard", True) hbox.addWidget(self.list_projects) self.list_templates = QListWidget() self.list_templates.setProperty("wizard", True) hbox.addWidget(self.list_templates) self.text_info = QTextBrowser() self.text_info.setProperty("wizard", True) hbox.addWidget(self.text_info) vbox.addLayout(hbox) hbox2 = QHBoxLayout() self.cancel = QPushButton(translations.TR_CANCEL) self.choose = QPushButton(translations.TR_CHOOSE) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox2.addWidget(self.cancel) hbox2.addWidget(self.choose) vbox.addLayout(hbox2)
def __init__(self): super(MigrationWidget, self).__init__() self._migration = {} vbox = QVBoxLayout(self) lbl_title = QLabel(self.tr("Current code:")) self.current_list = QListWidget() lbl_suggestion = QLabel(self.tr("Suggested changes:")) self.suggestion = QPlainTextEdit() self.suggestion.setReadOnly(True) self.btn_apply = QPushButton(self.tr("Apply change!")) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(self.btn_apply) vbox.addWidget(lbl_title) vbox.addWidget(self.current_list) vbox.addWidget(lbl_suggestion) vbox.addWidget(self.suggestion) vbox.addLayout(hbox) self.connect(self.current_list, SIGNAL("itemClicked(QListWidgetItem*)"), self.load_suggestion) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes) ExplorerContainer.register_tab(translations.TR_TAB_MIGRATION, self)
def __init__(self, mainloop, addr, title, parent=None): QWidget.__init__(self, parent) self.mainloop = mainloop self.addr = addr self.title = QLabel(title) self.title.setFont(QFont('Monospace', 16)) self.message = QLabel('') self.message.setFont(QFont('Monospace', 13)) self.bt_open = self.init_button('arrow-up-icon.png', QSize(50, 50)) self.bt_close = self.init_button('arrow-down-icon.png', QSize(50, 50)) info_layout = QVBoxLayout() info_layout.addWidget(self.title) layout = QHBoxLayout() layout.addLayout(info_layout) layout.addSpacerItem(QSpacerItem(0, 0, QSizePolicy.Expanding)) self.options_layout = QHBoxLayout() layout.addLayout(self.options_layout) layout.addWidget(self.bt_open) layout.addWidget(self.bt_close) self.setLayout(layout) self.bt_open.clicked.connect(self.open) self.bt_close.clicked.connect(self.close) self.grabGesture(Qt.TapAndHoldGesture)
def __init__(self, suggested, parent=None): super(PythonDetectDialog, self).__init__(parent, Qt.Dialog) self.setMaximumSize(QSize(0, 0)) self.setWindowTitle("Configure Python Path") vbox = QVBoxLayout(self) msg_str = ("We have detected that you are using " "Windows,\nplease choose the proper " "Python application for you:") lblMessage = QLabel(self.tr(msg_str)) vbox.addWidget(lblMessage) self.listPaths = QListWidget() self.listPaths.setSelectionMode(QListWidget.SingleSelection) vbox.addWidget(self.listPaths) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btnCancel = QPushButton(self.tr("Cancel")) btnAccept = QPushButton(self.tr("Accept")) hbox.addWidget(btnCancel) hbox.addWidget(btnAccept) vbox.addLayout(hbox) self.connect(btnAccept, SIGNAL("clicked()"), self._set_python_path) self.connect(btnCancel, SIGNAL("clicked()"), self.close) for path in suggested: self.listPaths.addItem(path) self.listPaths.setCurrentRow(0)
def __init__(self, suggested, parent=None): super(PythonDetectDialog, self).__init__(parent, Qt.Dialog) self.setMaximumSize(QSize(0, 0)) self.setWindowTitle("Configure Python Path") vbox = QVBoxLayout(self) lblMessage = QLabel(self.tr("We have detected that you are using " + "Windows,\nplease choose the proper " + "Python application for you:")) vbox.addWidget(lblMessage) self.listPaths = QListWidget() self.listPaths.setSelectionMode(QListWidget.SingleSelection) vbox.addWidget(self.listPaths) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btnCancel = QPushButton(self.tr("Cancel")) btnAccept = QPushButton(self.tr("Accept")) hbox.addWidget(btnCancel) hbox.addWidget(btnAccept) vbox.addLayout(hbox) self.connect(btnAccept, SIGNAL("clicked()"), self._set_python_path) self.connect(btnCancel, SIGNAL("clicked()"), self.close) for path in suggested: self.listPaths.addItem(path) self.listPaths.setCurrentRow(0)
def __init__(self, parent=None): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle(self.tr("About NINJA-IDE")) self.setMaximumSize(QSize(0, 0)) vbox = QVBoxLayout(self) # Create an icon for the Dialog pixmap = QPixmap(":img/icon") self.lblIcon = QLabel() self.lblIcon.setPixmap(pixmap) hbox = QHBoxLayout() hbox.addWidget(self.lblIcon) lblTitle = QLabel("<h1>NINJA-IDE</h1>\n<i>Ninja-IDE Is Not Just Another IDE<i>") lblTitle.setTextFormat(Qt.RichText) lblTitle.setAlignment(Qt.AlignLeft) hbox.addWidget(lblTitle) vbox.addLayout(hbox) # Add description vbox.addWidget( QLabel( self.tr( """NINJA-IDE (from: "Ninja Is Not Just Another IDE"), is a cross-platform integrated development environment specifically designed to build Python Applications. NINJA-IDE provides the tools necessary to simplify the Python software development process and handles all kinds of situations thanks to its rich extensibility.""" ) ) ) vbox.addWidget(QLabel(self.tr("Version: %s") % ninja_ide.__version__)) link_ninja = QLabel( self.tr( 'Website: <a href="%s"><span style=" ' 'text-decoration: underline; color:#ff9e21;">' "%s</span></a>" ) % (ninja_ide.__url__, ninja_ide.__url__) ) vbox.addWidget(link_ninja) link_source = QLabel( self.tr( 'Source Code: <a href="%s"><span style=" ' 'text-decoration: underline; color:#ff9e21;">%s</span></a>' ) % (ninja_ide.__source__, ninja_ide.__source__) ) vbox.addWidget(link_source) hbox2 = QHBoxLayout() hbox2.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btn_close = QPushButton(translations.TR_CLOSE) hbox2.addWidget(btn_close) vbox.addLayout(hbox2) self.connect(link_ninja, SIGNAL("linkActivated(QString)"), self.link_activated) self.connect(link_source, SIGNAL("linkActivated(QString)"), self.link_activated) self.connect(btn_close, SIGNAL("clicked()"), self.close)
def __init__(self, parent): QDialog.__init__(self, parent, Qt.WindowMinMaxButtonsHint) self.clicks = 0 self.setWindowTitle(self.tr("Acerca de Edis")) self.setMinimumWidth(485) box = QVBoxLayout(self) self.label_logo = QLabel() self.label_logo.setPixmap(QPixmap(":image/edis")) title_label = QLabel(self.tr("<h1>Edis</h1>\n<i>a simple " "cross-platform IDE for C</i>")) title_label.setAlignment(Qt.AlignRight) box_logo = QHBoxLayout() box_logo.addWidget(self.label_logo) box_logo.addWidget(title_label) box.addLayout(box_logo) lbl_version = QLabel(self.tr("<b>Versión:</b> {0}").format(ui.__version__)) box.addWidget(lbl_version) http = "http://" lbl_link = QLabel( "<b>Web:</b> <a href='%s'><span style='color: " "#626655;'>%s</span></a>" % (ui.__web__, ui.__web__.replace(http, "")) ) lbl_sc = QLabel( self.tr("<b>Código fuente:</b> <a href='{0}'><span" " style='color: #626655;'>{1}</span></a>").format( ui.__source_code__, ui.__source_code__.replace(http, "") ) ) box.addWidget(lbl_link) box.addWidget(lbl_sc) # License box.addWidget( QLabel( self.tr( "<b>Licencia:</b> <i>Edis</i> se " "distribuye bajo los términos de la " "licencia <b>GPLv3+</b>" ) ) ) box.addWidget(QLabel(self.tr("<b>Autor:</b> {0}").format(ui.__author__))) box.addWidget(QLabel(self.tr("<b>e-mail:</b> {0}").format(ui.__email_author__))) # Thanks to lbl_contributors = QLabel( self.tr( "Agradezco a los que <a href=" "{0}><span style='color: #626655;'>" "contribuyeron</span></a> con Edis" ).format(ui.__contributors__) ) box.addWidget(lbl_contributors) box_boton = QHBoxLayout() box_boton.addSpacerItem(QSpacerItem(0, 10, QSizePolicy.Expanding)) btn_ok = QPushButton(self.tr("Aceptar")) box_boton.addWidget(btn_ok) box.addLayout(box_boton) # Conexiones btn_ok.clicked.connect(self.close) lbl_link.linkActivated["QString"].connect(self._open_link) lbl_sc.linkActivated["QString"].connect(self._open_link) lbl_contributors.linkActivated["QString"].connect(self._open_link) self.label_logo.installEventFilter(self)
class Appointment(QWidget): def __init__(self, parent = None): super(Appointment, self).__init__(parent) #std. settings self.stdFont = QFont("Arial", 16) self.bigFont = QFont("Arial", 48) #layouts self.mainLayout = QHBoxLayout() self.leftLayout = QVBoxLayout() self.rightLayout = QVBoxLayout() #components self.participantLabel = QLabel("Participant Name") self.participantLabel.setFont(self.stdFont) self.eventTitle = QLabel("Event Title") self.eventTitle.setFont(self.bigFont) self.eventStart = QLabel("Event Start") self.eventStart.setFont(self.stdFont) self.eventEnd = QLabel("Event End") self.eventEnd.setFont(self.stdFont) self.leftLayout.addWidget(self.eventStart) self.leftLayout.addStretch() self.leftLayout.addWidget(self.eventEnd) self.rightLayout.addStretch() self.rightLayout.addWidget(self.participantLabel) self.rightLayout.addWidget(self.eventTitle) self.rightLayout.addStretch() self.mainLayout.addLayout(self.leftLayout) self.mainLayout.addSpacerItem(QSpacerItem(1,128)) self.mainLayout.addLayout(self.rightLayout) self.setLayout(self.mainLayout) self.mainLayout.setMargin(0) self.mainLayout.setSpacing(0) self.setStyleSheet("background-color: #ccc; color: #fff") self.setFixedHeight(128) def setTitle(self, title): self.eventTitle.setText(title) def setStartTime(self,start): self.eventStart.setText(start) def setEndTime(self, end): self.eventEnd.setText(end) def setParticipants(self,participants): self.participantLabel.setText(participants)
def __init__(self, parent=None): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle(self.tr("About NINJA-IDE")) self.setMaximumSize(QSize(0, 0)) vbox = QVBoxLayout(self) #Create an icon for the Dialog pixmap = QPixmap(":img/icon") self.lblIcon = QLabel() self.lblIcon.setPixmap(pixmap) hbox = QHBoxLayout() hbox.addWidget(self.lblIcon) lblTitle = QLabel( '<h1>NINJA-IDE</h1>\n<i>Ninja-IDE Is Not Just Another IDE<i>') lblTitle.setTextFormat(Qt.RichText) lblTitle.setAlignment(Qt.AlignLeft) hbox.addWidget(lblTitle) vbox.addLayout(hbox) #Add description vbox.addWidget( QLabel( self.tr( """NINJA-IDE (from: "Ninja Is Not Just Another IDE"), is a cross-platform integrated development environment specifically designed to build Python Applications. NINJA-IDE provides the tools necessary to simplify the Python software development process and handles all kinds of situations thanks to its rich extensibility."""))) vbox.addWidget(QLabel(self.tr("Version: %s") % ninja_ide.__version__)) link_ninja = QLabel( self.tr('Website: <a href="%s"><span style=" ' 'text-decoration: underline; color:#ff9e21;">' '%s</span></a>') % (ninja_ide.__url__, ninja_ide.__url__)) vbox.addWidget(link_ninja) link_source = QLabel( self.tr( 'Source Code: <a href="%s"><span style=" ' 'text-decoration: underline; color:#ff9e21;">%s</span></a>') % (ninja_ide.__source__, ninja_ide.__source__)) vbox.addWidget(link_source) hbox2 = QHBoxLayout() hbox2.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btn_close = QPushButton(translations.TR_CLOSE) hbox2.addWidget(btn_close) vbox.addLayout(hbox2) self.connect(link_ninja, SIGNAL("linkActivated(QString)"), self.link_activated) self.connect(link_source, SIGNAL("linkActivated(QString)"), self.link_activated) self.connect(btn_close, SIGNAL("clicked()"), self.close)
def __init__(self, *args, **kwargs): super(ShortcutManagerDlg, self).__init__(*args, **kwargs) self.setWindowTitle("Shortcut Preferences") self.setMinimumWidth(500) mgr = ShortcutManager() # Singleton tempLayout = QVBoxLayout() # Create a LineEdit for each shortcut, # and keep track of them in a dict shortcutEdits = dict() for group, shortcutDict in mgr.shortcuts.items(): grpBox = QGroupBox(group) l = QGridLayout(self) for i, (shortcut, (desc, obj)) in enumerate(shortcutDict.items()): l.addWidget(QLabel(desc), i, 0) edit = QLineEdit(str(shortcut.key().toString())) l.addWidget(edit, i, 1) shortcutEdits[shortcut] = edit grpBox.setLayout(l) tempLayout.addWidget(grpBox) # Add ok and cancel buttons buttonLayout = QHBoxLayout() cancelButton = QPushButton("Cancel") cancelButton.clicked.connect(self.reject) okButton = QPushButton("OK") okButton.clicked.connect(self.accept) okButton.setDefault(True) buttonLayout.addSpacerItem(QSpacerItem(10, 0)) buttonLayout.addWidget(cancelButton) buttonLayout.addWidget(okButton) tempLayout.addLayout(buttonLayout) self.setLayout(tempLayout) # Show the window result = self.exec_() # If the user didn't hit "cancel", apply his changes to the manager's shortcuts if result == QDialog.Accepted: for shortcut, edit in shortcutEdits.items(): oldKey = shortcut.key() newKey = str(edit.text()) shortcut.setKey(QKeySequence(newKey)) # If the user typed an invalid shortcut, then keep the old value if shortcut.key().isEmpty(): shortcut.setKey(oldKey) # Make sure the tooltips get updated. mgr.updateToolTip(shortcut) mgr.storeToPreferences()
def __init__(self, *args, **kwargs): super(ShortcutManagerDlg, self).__init__(*args, **kwargs) self.setWindowTitle("Shortcut Preferences") self.setMinimumWidth(500) mgr = ShortcutManager() # Singleton tempLayout = QVBoxLayout() # Create a LineEdit for each shortcut, # and keep track of them in a dict shortcutEdits = dict() for group, shortcutDict in mgr.shortcuts.items(): grpBox = QGroupBox(group) l = QGridLayout(self) for i, (shortcut, (desc, obj)) in enumerate(shortcutDict.items()): l.addWidget(QLabel(desc), i,0) edit = QLineEdit(str(shortcut.key().toString())) l.addWidget(edit, i,1) shortcutEdits[shortcut] = edit grpBox.setLayout(l) tempLayout.addWidget(grpBox) # Add ok and cancel buttons buttonLayout = QHBoxLayout() cancelButton = QPushButton("Cancel") cancelButton.clicked.connect( self.reject ) okButton = QPushButton("OK") okButton.clicked.connect( self.accept ) okButton.setDefault(True) buttonLayout.addSpacerItem(QSpacerItem(10, 0)) buttonLayout.addWidget(cancelButton) buttonLayout.addWidget(okButton) tempLayout.addLayout(buttonLayout) self.setLayout(tempLayout) # Show the window result = self.exec_() # If the user didn't hit "cancel", apply his changes to the manager's shortcuts if result == QDialog.Accepted: for shortcut, edit in shortcutEdits.items(): oldKey = shortcut.key() newKey = str(edit.text()) shortcut.setKey( QKeySequence(newKey) ) # If the user typed an invalid shortcut, then keep the old value if shortcut.key().isEmpty(): shortcut.setKey(oldKey) # Make sure the tooltips get updated. mgr.updateToolTip(shortcut) mgr.storeToPreferences()
def getLayout(skillBox1, skillBox2=None): layout = QHBoxLayout() layout.addWidget(skillBox1) layout.addSpacerItem(QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)) if skillBox2: layout.addWidget(skillBox2) layout.addSpacerItem(QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)) layout.setContentsMargins(0, 0, 0, 0) return layout
def setup_ui(self): """Load all the components of the ui during the install process.""" vbox = QVBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) self.__toolbar = QToolBar() self.__toolbar.setObjectName('custom') hbox = QHBoxLayout() vbox.addLayout(hbox) self.stack = StackedWidget() vbox.addWidget(self.stack) self._console = console_widget.ConsoleWidget() self._runWidget = run_widget.RunWidget() self._web = web_render.WebRender() self._findInFilesWidget = find_in_files.FindInFilesWidget( self.parent()) # Not Configurable Shortcuts shortEscMisc = QShortcut(QKeySequence(Qt.Key_Escape), self) self.connect(shortEscMisc, SIGNAL("activated()"), self.hide) #Toolbar hbox.addWidget(self.__toolbar) self.add_to_stack(self._console, ":img/console", translations.TR_CONSOLE) self.add_to_stack(self._runWidget, ":img/play", translations.TR_OUTPUT) self.add_to_stack(self._web, ":img/web", translations.TR_WEB_PREVIEW) self.add_to_stack(self._findInFilesWidget, ":img/find", translations.TR_FIND_IN_FILES) #Last Element in the Stacked widget self._results = results.Results(self) self.stack.addWidget(self._results) self.__toolbar.addSeparator() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btn_close = QPushButton( self.style().standardIcon(QStyle.SP_DialogCloseButton), '') btn_close.setIconSize(QSize(24, 24)) btn_close.setObjectName('navigation_button') btn_close.setToolTip('F4: ' + translations.TR_ALL_VISIBILITY) hbox.addWidget(btn_close) self.connect(btn_close, SIGNAL('clicked()'), self.hide)
def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle(self.tr("Plugins Manager")) self.resize(700, 600) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) self._txt_data = QTextBrowser() self._txt_data.setOpenLinks(False) vbox.addWidget(QLabel(self.tr("Description:"))) vbox.addWidget(self._txt_data) # Footer hbox = QHBoxLayout() btn_close = QPushButton(self.tr('Close')) btnReload = QPushButton(self.tr("Reload")) hbox.addWidget(btn_close) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnReload) vbox.addLayout(hbox) self.overlay = ui_tools.Overlay(self) self.overlay.hide() self._oficial_available = [] self._community_available = [] self._locals = [] self._updates = [] self._loading = True self._requirements = {} self.connect(btnReload, SIGNAL("clicked()"), self._reload_plugins) self.thread = ThreadLoadPlugins(self) self.connect(self.thread, SIGNAL("finished()"), self._load_plugins_data) self.connect(self.thread, SIGNAL("plugin_downloaded(PyQt_PyObject)"), self._after_download_plugin) self.connect(self.thread, SIGNAL("plugin_manually_installed(PyQt_PyObject)"), self._after_manual_install_plugin) self.connect(self.thread, SIGNAL("plugin_uninstalled(PyQt_PyObject)"), self._after_uninstall_plugin) self.connect(self._txt_data, SIGNAL("anchorClicked(const QUrl&)"), self._open_link) self.connect(btn_close, SIGNAL('clicked()'), self.close) self.overlay.show() self._reload_plugins()
def __init__(self, parent): QDialog.__init__(self, parent, Qt.Dialog) self.setWindowTitle(translations.TR_PLUGIN_MANAGER) self.resize(700, 600) vbox = QVBoxLayout(self) self._tabs = QTabWidget() vbox.addWidget(self._tabs) self._txt_data = QTextBrowser() self._txt_data.setOpenLinks(False) vbox.addWidget(QLabel(translations.TR_PROJECT_DESCRIPTION)) vbox.addWidget(self._txt_data) # Footer hbox = QHBoxLayout() btn_close = QPushButton(translations.TR_CLOSE) btnReload = QPushButton(translations.TR_RELOAD) hbox.addWidget(btn_close) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnReload) vbox.addLayout(hbox) self.overlay = ui_tools.Overlay(self) self.overlay.hide() self._oficial_available = [] self._community_available = [] self._locals = [] self._updates = [] self._loading = True self._requirements = {} self.connect(btnReload, SIGNAL("clicked()"), self._reload_plugins) self.thread = ThreadLoadPlugins(self) self.connect(self.thread, SIGNAL("finished()"), self._load_plugins_data) self.connect(self.thread, SIGNAL("plugin_downloaded(PyQt_PyObject)"), self._after_download_plugin) self.connect(self.thread, SIGNAL("plugin_manually_installed(PyQt_PyObject)"), self._after_manual_install_plugin) self.connect(self.thread, SIGNAL("plugin_uninstalled(PyQt_PyObject)"), self._after_uninstall_plugin) self.connect(self._txt_data, SIGNAL("anchorClicked(const QUrl&)"), self._open_link) self.connect(btn_close, SIGNAL('clicked()'), self.close) self.overlay.show() self._reload_plugins()
def __init__(self, parent=None): super(NewProjectManager, self).__init__(parent, Qt.Dialog) self.setWindowTitle(translations.TR_NEW_PROJECT) self.setMinimumHeight(500) vbox = QVBoxLayout(self) vbox.addWidget(QLabel(translations.TR_CHOOSE_TEMPLATE)) vbox.addWidget(QLabel(translations.TR_TAB_PROJECTS)) hbox = QHBoxLayout() self.list_projects = QListWidget() self.list_projects.setProperty("wizard", True) hbox.addWidget(self.list_projects) self.list_templates = QListWidget() self.list_templates.setProperty("wizard", True) hbox.addWidget(self.list_templates) self.text_info = QTextBrowser() self.text_info.setProperty("wizard", True) hbox.addWidget(self.text_info) vbox.addLayout(hbox) hbox2 = QHBoxLayout() cancel = QPushButton(translations.TR_CANCEL) choose = QPushButton(translations.TR_CHOOSE) hbox2.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox2.addWidget(cancel) hbox2.addWidget(choose) vbox.addLayout(hbox2) self.template_registry = IDE.get_service("template_registry") categories = self.template_registry.list_project_categories() for category in categories: self.list_projects.addItem(category) self.connect(cancel, SIGNAL("clicked()"), self.close) self.connect(choose, SIGNAL("clicked()"), self._start_wizard) self.connect(self.list_projects, SIGNAL("itemSelectionChanged()"), self._project_selected) self.connect(self.list_templates, SIGNAL("itemSelectionChanged()"), self._template_selected)
def __init__(self): super(ErrorsWidget, self).__init__() self.pep8 = None self._outRefresh = True vbox = QVBoxLayout(self) self.listErrors = QListWidget() self.listErrors.setSortingEnabled(True) self.listPep8 = QListWidget() self.listPep8.setSortingEnabled(True) hbox_lint = QHBoxLayout() if settings.FIND_ERRORS: self.btn_lint_activate = QPushButton(self.tr("Lint: ON")) else: self.btn_lint_activate = QPushButton(self.tr("Lint: OFF")) self.errorsLabel = QLabel(self.tr("Static Errors: %s") % 0) hbox_lint.addWidget(self.errorsLabel) hbox_lint.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_lint.addWidget(self.btn_lint_activate) vbox.addLayout(hbox_lint) vbox.addWidget(self.listErrors) hbox_pep8 = QHBoxLayout() if settings.CHECK_STYLE: self.btn_pep8_activate = QPushButton(self.tr("PEP8: ON")) else: self.btn_pep8_activate = QPushButton(self.tr("PEP8: OFF")) self.pep8Label = QLabel(self.tr("PEP8 Errors: %s") % 0) hbox_pep8.addWidget(self.pep8Label) hbox_pep8.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_pep8.addWidget(self.btn_pep8_activate) vbox.addLayout(hbox_pep8) vbox.addWidget(self.listPep8) self.connect(self.listErrors, SIGNAL("itemSelectionChanged()"), self.errors_selected) self.connect(self.listPep8, SIGNAL("itemSelectionChanged()"), self.pep8_selected) self.connect(self.btn_lint_activate, SIGNAL("clicked()"), self._turn_on_off_lint) self.connect(self.btn_pep8_activate, SIGNAL("clicked()"), self._turn_on_off_pep8) IDE.register_service('tab_errors', self) ExplorerContainer.register_tab(translations.TR_TAB_ERRORS, self)
def __init__(self, parent=None): super(ErrorsWidget, self).__init__(parent, Qt.WindowStaysOnTopHint) self.pep8 = None self._outRefresh = True vbox = QVBoxLayout(self) self.listErrors = QListWidget() self.listErrors.setSortingEnabled(True) self.listPep8 = QListWidget() self.listPep8.setSortingEnabled(True) hbox_lint = QHBoxLayout() if settings.FIND_ERRORS: self.btn_lint_activate = QPushButton(self.tr("Lint: ON")) else: self.btn_lint_activate = QPushButton(self.tr("Lint: OFF")) self.errorsLabel = QLabel(self.tr("Static Errors: %s") % 0) hbox_lint.addWidget(self.errorsLabel) hbox_lint.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_lint.addWidget(self.btn_lint_activate) vbox.addLayout(hbox_lint) vbox.addWidget(self.listErrors) hbox_pep8 = QHBoxLayout() if settings.CHECK_STYLE: self.btn_pep8_activate = QPushButton(self.tr("PEP8: ON")) else: self.btn_pep8_activate = QPushButton(self.tr("PEP8: OFF")) self.pep8Label = QLabel(self.tr("PEP8 Errors: %s") % 0) hbox_pep8.addWidget(self.pep8Label) hbox_pep8.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_pep8.addWidget(self.btn_pep8_activate) vbox.addLayout(hbox_pep8) vbox.addWidget(self.listPep8) self.connect(self.listErrors, SIGNAL("itemSelectionChanged()"), self.errors_selected) self.connect(self.listPep8, SIGNAL("itemSelectionChanged()"), self.pep8_selected) self.connect(self.btn_lint_activate, SIGNAL("clicked()"), self._turn_on_off_lint) self.connect(self.btn_pep8_activate, SIGNAL("clicked()"), self._turn_on_off_pep8) IDE.register_service('tab_errors', self) ExplorerContainer.register_tab(translations.TR_TAB_ERRORS, self)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setWindowTitle(self.tr("Acerca de Pireal")) vbox = QVBoxLayout(self) # Banner banner = QLabel() banner.setPixmap(QPixmap(":img/banner").scaled(300, 120)) banner.setAlignment(Qt.AlignHCenter) vbox.addWidget(banner) # Description description = QLabel(self.tr("<b>Pireal</b> es una herramienta " "educativa para trabajar con Álgebra " "Relacional.<br>")) vbox.addWidget(description) # Links, author, source vbox.addWidget(QLabel(self.tr("<b>Versión:</b> {}").format( gui.__version__))) source = QLabel(self.tr("<b>Código fuente:</b> <a href=" "'{0}'>{1}</a>").format(gui.__source_code__, gui.__source_code__)) vbox.addWidget(source) lname, llink = gui.__license__.split() _license = QLabel(self.tr("<b>Licencia:</b> <a href=" "'{0}'>{1}</a>").format(llink, lname)) vbox.addWidget(_license) vbox.addWidget(QLabel(self.tr("<b>Autor:</b> {}").format( gui.__author__))) vbox.addWidget(QLabel(self.tr("<b>e-mail:</b> {}").format( gui.__email__))) # Button ok hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(0, 0, QSizePolicy.Expanding)) btn_ok = QPushButton("Ok") hbox.addWidget(btn_ok) vbox.addLayout(hbox) self.connect(btn_ok, SIGNAL("clicked()"), self.close) self.connect(source, SIGNAL("linkActivated(QString)"), lambda link: webbrowser.open_new(link)) self.connect(_license, SIGNAL("linkActivated(QString)"), lambda link: webbrowser.open_new(link))
def __init__(self, project, name, parent): super(TabGroup, self).__init__(parent) vbox = QVBoxLayout(self) self.ID = project self.name = name self.tabs = [] self.listWidget = QListWidget() hbox = QHBoxLayout() btnExpand = QPushButton(self.tr("Expand this Files")) btnExpandAll = QPushButton(self.tr("Expand all Groups")) hbox.addWidget(btnExpandAll) hbox.addSpacerItem(QSpacerItem(20, 20, QSizePolicy.Expanding)) hbox.addWidget(btnExpand) vbox.addLayout(hbox) vbox.addWidget(self.listWidget) self.connect(btnExpand, SIGNAL("clicked()"), self.expand) self.connect(btnExpandAll, SIGNAL("clicked()"), lambda: self.emit(SIGNAL("expandAll()")))
def __init__(self, parent): super(ThemeEditor, self).__init__(parent, Qt.Dialog) vbox = QVBoxLayout(self) hbox = QHBoxLayout() self.line_name = QLineEdit() self.btn_save = QPushButton(translations.TR_SAVE) self.line_name.setPlaceholderText(getuser().capitalize() + "s_theme") hbox.addWidget(self.line_name) hbox.addWidget(self.btn_save) self.edit_qss = QPlainTextEdit() css = 'QPlainTextEdit {color: %s; background-color: %s;' \ 'selection-color: %s; selection-background-color: %s;}' \ % (resources.CUSTOM_SCHEME.get( 'editor-text', resources.COLOR_SCHEME['Default']), resources.CUSTOM_SCHEME.get( 'EditorBackground', resources.COLOR_SCHEME['EditorBackground']), resources.CUSTOM_SCHEME.get( 'EditorSelectionColor', resources.COLOR_SCHEME['EditorSelectionColor']), resources.CUSTOM_SCHEME.get( 'EditorSelectionBackground', resources.COLOR_SCHEME['EditorSelectionBackground'])) self.edit_qss.setStyleSheet(css) self.btn_apply = QPushButton(self.tr("Apply Style Sheet")) hbox2 = QHBoxLayout() hbox2.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox2.addWidget(self.btn_apply) hbox2.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) vbox.addWidget(self.edit_qss) vbox.addLayout(hbox) vbox.addLayout(hbox2) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_stylesheet) self.connect(self.btn_save, SIGNAL("clicked()"), self.save_stylesheet)
def __init__(self): QWidget.__init__(self) self.pep8 = None self._outRefresh = True vbox = QVBoxLayout(self) self.listErrors = QListWidget() self.listErrors.setSortingEnabled(True) self.listPep8 = QListWidget() self.listPep8.setSortingEnabled(True) hbox_lint = QHBoxLayout() if settings.FIND_ERRORS: self.btn_lint_activate = QPushButton(self.tr("Lint: ON")) else: self.btn_lint_activate = QPushButton(self.tr("Lint: OFF")) self.errorsLabel = QLabel(self.tr("Static Errors: %s") % 0) hbox_lint.addWidget(self.errorsLabel) hbox_lint.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_lint.addWidget(self.btn_lint_activate) vbox.addLayout(hbox_lint) vbox.addWidget(self.listErrors) hbox_pep8 = QHBoxLayout() if settings.CHECK_STYLE: self.btn_pep8_activate = QPushButton(self.tr("PEP8: ON")) else: self.btn_pep8_activate = QPushButton(self.tr("PEP8: OFF")) self.pep8Label = QLabel(self.tr("PEP8 Errors: %s") % 0) hbox_pep8.addWidget(self.pep8Label) hbox_pep8.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_pep8.addWidget(self.btn_pep8_activate) vbox.addLayout(hbox_pep8) vbox.addWidget(self.listPep8) self.connect(self.listErrors, SIGNAL("itemSelectionChanged()"), self.errors_selected) self.connect(self.listPep8, SIGNAL("itemSelectionChanged()"), self.pep8_selected) self.connect(self.btn_lint_activate, SIGNAL("clicked()"), self._turn_on_off_lint) self.connect(self.btn_pep8_activate, SIGNAL("clicked()"), self._turn_on_off_pep8)
def __init__(self): QWidget.__init__(self) self.pep8 = None self._outRefresh = True vbox = QVBoxLayout(self) self.listErrors = QListWidget() self.listErrors.setSortingEnabled(True) self.listPep8 = QListWidget() self.listPep8.setSortingEnabled(True) hbox_lint = QHBoxLayout() if settings.FIND_ERRORS: self.btn_lint_activate = QPushButton(self.tr("Lint: ON")) else: self.btn_lint_activate = QPushButton(self.tr("Lint: OFF")) self.errorsLabel = QLabel(self.tr(ERRORS_TEXT % 0)) hbox_lint.addWidget(self.errorsLabel) hbox_lint.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_lint.addWidget(self.btn_lint_activate) vbox.addLayout(hbox_lint) vbox.addWidget(self.listErrors) hbox_pep8 = QHBoxLayout() if settings.CHECK_STYLE: self.btn_pep8_activate = QPushButton(self.tr("PEP8: ON")) else: self.btn_pep8_activate = QPushButton(self.tr("PEP8: OFF")) self.pep8Label = QLabel(self.tr(PEP8_TEXT % 0)) hbox_pep8.addWidget(self.pep8Label) hbox_pep8.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_pep8.addWidget(self.btn_pep8_activate) vbox.addLayout(hbox_pep8) vbox.addWidget(self.listPep8) self.connect(self.listErrors, SIGNAL("itemSelectionChanged()"), self.errors_selected) self.connect(self.listPep8, SIGNAL("itemSelectionChanged()"), self.pep8_selected) self.connect(self.btn_lint_activate, SIGNAL("clicked()"), self._turn_on_off_lint) self.connect(self.btn_pep8_activate, SIGNAL("clicked()"), self._turn_on_off_pep8)
def __init__(self, parent): super(ThemeEditor, self).__init__(parent, Qt.Dialog) vbox = QVBoxLayout(self) hbox = QHBoxLayout() self.line_name = QLineEdit() self.btn_save = QPushButton(translations.TR_SAVE) self.line_name.setPlaceholderText(getuser().capitalize() + "s_theme") hbox.addWidget(self.line_name) hbox.addWidget(self.btn_save) self.edit_qss = QPlainTextEdit() css = 'QPlainTextEdit {color: %s; background-color: %s;' \ 'selection-color: %s; selection-background-color: %s;}' \ % (resources.CUSTOM_SCHEME.get( 'editor-text', resources.COLOR_SCHEME['Default']), resources.CUSTOM_SCHEME.get( 'EditorBackground', resources.COLOR_SCHEME['EditorBackground']), resources.CUSTOM_SCHEME.get( 'EditorSelectionColor', resources.COLOR_SCHEME['EditorSelectionColor']), resources.CUSTOM_SCHEME.get( 'EditorSelectionBackground', resources.COLOR_SCHEME['EditorSelectionBackground'])) self.edit_qss.setStyleSheet(css) self.btn_apply = QPushButton(self.tr("Apply Style Sheet")) hbox2 = QHBoxLayout() hbox2.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox2.addWidget(self.btn_apply) hbox2.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) vbox.addWidget(self.edit_qss) vbox.addLayout(hbox) vbox.addLayout(hbox2) self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_stylesheet) self.connect(self.btn_save, SIGNAL("clicked()"), self.save_stylesheet)
def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtName.setPlaceholderText('my_plugin') self._txtVersion = QLineEdit() self._txtVersion.setPlaceholderText('0.1') form.addRow(translations.TR_PROJECT_NAME, self._txtName) form.addRow(translations.TR_VERSION, self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._txtFilePath.setPlaceholderText( os.path.join(os.path.expanduser('~'), 'full', 'path', 'to', 'plugin.zip')) self._btnFilePath = QPushButton(QIcon(":img/open"), '') self.completer, self.dirs = QCompleter(self), QDirModel(self) self.dirs.setFilter(QDir.AllEntries | QDir.NoDotAndDotDot) self.completer.setModel(self.dirs) self._txtFilePath.setCompleter(self.completer) hPath.addWidget(QLabel(translations.TR_FILENAME)) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem( QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(translations.TR_INSTALL) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) # Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def __init__(self, parent=None): super(Preferences, self).__init__(parent, Qt.Dialog) self.setWindowTitle(translations.TR_PREFERENCES_TITLE) self.setMinimumSize(QSize(800, 600)) self.setMaximumSize(QSize(0, 0)) vbox = QVBoxLayout(self) hbox = QHBoxLayout() vbox.setContentsMargins(0, 0, 5, 5) hbox.setContentsMargins(0, 0, 0, 0) self.tree = QTreeWidget() self.tree.header().setHidden(True) self.tree.setSelectionMode(QTreeWidget.SingleSelection) self.tree.setAnimated(True) self.tree.header().setHorizontalScrollMode( QAbstractItemView.ScrollPerPixel) self.tree.header().setResizeMode(0, QHeaderView.ResizeToContents) self.tree.header().setStretchLastSection(False) self.tree.setFixedWidth(200) self.stacked = QStackedLayout() hbox.addWidget(self.tree) hbox.addLayout(self.stacked) vbox.addLayout(hbox) hbox_footer = QHBoxLayout() self._btnSave = QPushButton(translations.TR_SAVE) self._btnCancel = QPushButton(translations.TR_CANCEL) hbox_footer.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox_footer.addWidget(self._btnCancel) hbox_footer.addWidget(self._btnSave) vbox.addLayout(hbox_footer) self.connect(self.tree, SIGNAL("itemSelectionChanged()"), self._change_current) self.connect(self._btnCancel, SIGNAL("clicked()"), self.close) self.connect(self._btnSave, SIGNAL("clicked()"), self._save_preferences) self.load_ui() self.tree.setCurrentItem(self.tree.topLevelItem(0))
def __init__(self, parent): super(ManualInstallWidget, self).__init__() self._parent = parent vbox = QVBoxLayout(self) form = QFormLayout() self._txtName = QLineEdit() self._txtName.setPlaceholderText('my_plugin') self._txtVersion = QLineEdit() self._txtVersion.setPlaceholderText('0.1') form.addRow(translations.TR_PROJECT_NAME, self._txtName) form.addRow(translations.TR_VERSION, self._txtVersion) vbox.addLayout(form) hPath = QHBoxLayout() self._txtFilePath = QLineEdit() self._txtFilePath.setPlaceholderText(os.path.join( os.path.expanduser('~'), 'full', 'path', 'to', 'plugin.zip')) self._btnFilePath = QPushButton(QIcon(":img/open"), '') self.completer, self.dirs = QCompleter(self), QDirModel(self) self.dirs.setFilter(QDir.AllEntries | QDir.NoDotAndDotDot) self.completer.setModel(self.dirs) self._txtFilePath.setCompleter(self.completer) hPath.addWidget(QLabel(translations.TR_FILENAME)) hPath.addWidget(self._txtFilePath) hPath.addWidget(self._btnFilePath) vbox.addLayout(hPath) vbox.addSpacerItem(QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)) hbox = QHBoxLayout() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) self._btnInstall = QPushButton(translations.TR_INSTALL) hbox.addWidget(self._btnInstall) vbox.addLayout(hbox) #Signals self.connect(self._btnFilePath, SIGNAL("clicked()"), self._load_plugin_path) self.connect(self._btnInstall, SIGNAL("clicked()"), self.install_plugin)
def __init__(self, project, name, actions): QWidget.__init__(self) itab_item.ITabItem.__init__(self) vbox = QVBoxLayout(self) self.actions = actions self.project = project self.ID = self.project self.name = name self.tabs = [] self.listWidget = QListWidget() hbox = QHBoxLayout() btnExpand = QPushButton(self.tr("Expand this Files")) btnExpandAll = QPushButton(self.tr("Expand all Groups")) hbox.addWidget(btnExpandAll) hbox.addSpacerItem(QSpacerItem(20, 20, QSizePolicy.Expanding)) hbox.addWidget(btnExpand) vbox.addLayout(hbox) vbox.addWidget(self.listWidget) self.connect(btnExpand, SIGNAL("clicked()"), self.expand_this) self.connect(btnExpandAll, SIGNAL("clicked()"), self.actions.deactivate_tabs_groups)
def initMainUi(self): role_names = self.parentApplet.dataSelectionApplet.topLevelOperator.DatasetRoles.value self.list_widgets = [] # Create a tab for each role for role_index, role_name in enumerate(role_names): select_button = QPushButton("Select " + role_name + " Files...", clicked=partial( self.select_files, role_index)) clear_button = QPushButton("Clear " + role_name + " Files", clicked=partial(self.clear_files, role_index)) button_layout = QHBoxLayout() button_layout.addWidget(select_button) button_layout.addSpacerItem( QSpacerItem(0, 0, hPolicy=QSizePolicy.Expanding)) button_layout.addWidget(clear_button) button_layout.setContentsMargins(0, 0, 0, 0) button_layout_widget = QWidget() button_layout_widget.setLayout(button_layout) button_layout_widget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)) list_widget = QListWidget(parent=self) list_widget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) self.list_widgets.append(list_widget) tab_layout = QVBoxLayout() tab_layout.setContentsMargins(0, 0, 0, 0) tab_layout.addWidget(button_layout_widget) tab_layout.addWidget(list_widget) layout_widget = QWidget(parent=self) layout_widget.setLayout(tab_layout) self.addTab(layout_widget, role_name)
def __init__(self, parent): QDialog.__init__(self, parent, Qt.WindowMinMaxButtonsHint) self.setWindowTitle(self.tr("Acerca de EDIS")) box = QVBoxLayout(self) label_logo = QLabel() label_logo.setPixmap(QPixmap(paths.ICONOS['icon'])) label_titulo = QLabel(self.tr("<h1>EDIS</h1>\n<i>Simple Integrated " "Development Environment</i>")) box_logo = QHBoxLayout() self.tabs = QTabWidget() self.tabs.addTab(AboutTab(), self.tr("Acerca de")) self.tabs.addTab(ReportarBugTab(), self.tr("Reportar bug")) box_logo.addWidget(label_logo) box_logo.addWidget(label_titulo) box.addLayout(box_logo) box.addWidget(self.tabs) box_boton = QHBoxLayout() box_boton.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) boton_ok = QPushButton(self.tr("Ok")) box_boton.addWidget(boton_ok) box.addLayout(box_boton) boton_ok.clicked.connect(self.close)
def __init__(self, parent): super(Theme, self).__init__() self._preferences, vbox = parent, QVBoxLayout(self) vbox.addWidget(QLabel(self.tr("<b>Select Theme:</b>"))) self.list_skins = QListWidget() self.list_skins.setSelectionMode(QListWidget.SingleSelection) vbox.addWidget(self.list_skins) self.btn_delete = QPushButton(self.tr("Delete Theme")) self.btn_preview = QPushButton(self.tr("Preview Theme")) self.btn_create = QPushButton(self.tr("Create Theme")) hbox = QHBoxLayout() hbox.addWidget(self.btn_delete) hbox.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox.addWidget(self.btn_preview) hbox.addWidget(self.btn_create) vbox.addLayout(hbox) self._refresh_list() self.connect(self.btn_preview, SIGNAL("clicked()"), self.preview_theme) self.connect(self.btn_delete, SIGNAL("clicked()"), self.delete_theme) self.connect(self.btn_create, SIGNAL("clicked()"), self.create_theme) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
def __init__(self, parent): super(Theme, self).__init__() self._preferences, vbox = parent, QVBoxLayout(self) vbox.addWidget(QLabel(self.tr("<b>Select Theme:</b>"))) self.list_skins = QListWidget() self.list_skins.setSelectionMode(QListWidget.SingleSelection) vbox.addWidget(self.list_skins) self.btn_delete = QPushButton(self.tr("Delete Theme")) self.btn_preview = QPushButton(self.tr("Preview Theme")) self.btn_create = QPushButton(self.tr("Create Theme")) hbox = QHBoxLayout() hbox.addWidget(self.btn_delete) hbox.addSpacerItem( QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed)) hbox.addWidget(self.btn_preview) hbox.addWidget(self.btn_create) vbox.addLayout(hbox) self._refresh_list() self.connect(self.btn_preview, SIGNAL("clicked()"), self.preview_theme) self.connect(self.btn_delete, SIGNAL("clicked()"), self.delete_theme) self.connect(self.btn_create, SIGNAL("clicked()"), self.create_theme) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
def control_layout(label_text, widget): row_layout = QHBoxLayout() row_layout.addWidget(QLabel(label_text)) row_layout.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding)) row_layout.addWidget(widget) return row_layout
def __init__(self, parent): super(EditorGeneral, self).__init__() self._preferences, vbox = parent, QVBoxLayout(self) self.original_style = copy.copy(resources.CUSTOM_SCHEME) self.current_scheme, self._modified_editors = 'default', [] self._font = settings.FONT groupBoxMini = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_MINIMAP) groupBoxTypo = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_TYPOGRAPHY) groupBoxScheme = QGroupBox( translations.TR_PREFERENCES_EDITOR_GENERAL_SCHEME) #Minimap formMini = QGridLayout(groupBoxMini) formMini.setContentsMargins(5, 15, 5, 5) self._checkShowMinimap = QCheckBox( translations.TR_PREFERENCES_EDITOR_GENERAL_ENABLE_MINIMAP) self._spinMaxOpacity = QSpinBox() self._spinMaxOpacity.setRange(0, 100) self._spinMaxOpacity.setSuffix("% Max.") self._spinMinOpacity = QSpinBox() self._spinMinOpacity.setRange(0, 100) self._spinMinOpacity.setSuffix("% Min.") self._spinSize = QSpinBox() self._spinSize.setMaximum(100) self._spinSize.setMinimum(0) self._spinSize.setSuffix( translations.TR_PREFERENCES_EDITOR_GENERAL_AREA_MINIMAP) formMini.addWidget(self._checkShowMinimap, 0, 1) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_SIZE_MINIMAP), 1, 0, Qt.AlignRight) formMini.addWidget(self._spinSize, 1, 1) formMini.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_OPACITY), 2, 0, Qt.AlignRight) formMini.addWidget(self._spinMinOpacity, 2, 1) formMini.addWidget(self._spinMaxOpacity, 2, 2) #Typo gridTypo = QGridLayout(groupBoxTypo) gridTypo.setContentsMargins(5, 15, 5, 5) self._btnEditorFont = QPushButton('') gridTypo.addWidget(QLabel( translations.TR_PREFERENCES_EDITOR_GENERAL_EDITOR_FONT), 0, 0, Qt.AlignRight) gridTypo.addWidget(self._btnEditorFont, 0, 1) #Scheme vboxScheme = QVBoxLayout(groupBoxScheme) vboxScheme.setContentsMargins(5, 15, 5, 5) self._listScheme = QListWidget() vboxScheme.addWidget(self._listScheme) hbox = QHBoxLayout() btnDownload = QPushButton( translations.TR_PREFERENCES_EDITOR_DOWNLOAD_SCHEME) btnDownload.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.connect(btnDownload, SIGNAL("clicked()"), self._open_schemes_manager) hbox.addWidget(btnDownload) btnAdd = QPushButton(QIcon(":img/add"), translations.TR_EDITOR_CREATE_SCHEME) btnAdd.setIconSize(QSize(16, 16)) btnAdd.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.connect(btnAdd, SIGNAL("clicked()"), self._open_schemes_designer) btnRemove = QPushButton(QIcon(":img/delete"), translations.TR_EDITOR_REMOVE_SCHEME) btnRemove.setIconSize(QSize(16, 16)) btnRemove.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.connect(btnRemove, SIGNAL("clicked()"), self._remove_scheme) hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) hbox.addWidget(btnAdd) hbox.addWidget(btnRemove) vboxScheme.addLayout(hbox) vbox.addWidget(groupBoxMini) vbox.addWidget(groupBoxTypo) vbox.addWidget(groupBoxScheme) #Settings qsettings = IDE.ninja_settings() qsettings.beginGroup('preferences') qsettings.beginGroup('editor') self._checkShowMinimap.setChecked(settings.SHOW_MINIMAP) if settings.IS_MAC_OS: self._spinMinOpacity.setValue(100) self._spinMaxOpacity.setValue(100) self._spinMinOpacity.setDisabled(True) self._spinMaxOpacity.setDisabled(True) else: self._spinMinOpacity.setValue(settings.MINIMAP_MIN_OPACITY * 100) self._spinMaxOpacity.setValue(settings.MINIMAP_MAX_OPACITY * 100) self._spinSize.setValue(settings.SIZE_PROPORTION * 100) btnText = ', '.join(self._font.toString().split(',')[0:2]) self._btnEditorFont.setText(btnText) self._listScheme.clear() self._listScheme.addItem('default') self._schemes = json_manager.load_editor_skins() for item in self._schemes: self._listScheme.addItem(item) items = self._listScheme.findItems( qsettings.value('scheme', defaultValue='', type='QString'), Qt.MatchExactly) if items: self._listScheme.setCurrentItem(items[0]) else: self._listScheme.setCurrentRow(0) qsettings.endGroup() qsettings.endGroup() #Signals self.connect(self._btnEditorFont, SIGNAL("clicked()"), self._load_editor_font) self.connect(self._listScheme, SIGNAL("itemSelectionChanged()"), self._preview_style) self.connect(self._preferences, SIGNAL("savePreferences()"), self.save)
def __createLayout(self, wpointModel): " Creates the widget layout " verticalLayout = QVBoxLayout(self) verticalLayout.setContentsMargins(0, 0, 0, 0) verticalLayout.setSpacing(0) self.headerFrame = QFrame() self.headerFrame.setFrameStyle(QFrame.StyledPanel) self.headerFrame.setAutoFillBackground(True) headerPalette = self.headerFrame.palette() headerBackground = headerPalette.color(QPalette.Background) headerBackground.setRgb(min(headerBackground.red() + 30, 255), min(headerBackground.green() + 30, 255), min(headerBackground.blue() + 30, 255)) headerPalette.setColor(QPalette.Background, headerBackground) self.headerFrame.setPalette(headerPalette) self.headerFrame.setFixedHeight(24) self.__watchpointLabel = QLabel("Watchpoints") expandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) fixedSpacer = QSpacerItem(3, 3) self.__showHideButton = QToolButton() self.__showHideButton.setAutoRaise(True) self.__showHideButton.setIcon(PixmapCache().getIcon('less.png')) self.__showHideButton.setFixedSize(20, 20) self.__showHideButton.setToolTip("Hide ignored exceptions list") self.__showHideButton.setFocusPolicy(Qt.NoFocus) self.__showHideButton.clicked.connect(self.__onShowHide) headerLayout = QHBoxLayout() headerLayout.setContentsMargins(1, 1, 1, 1) headerLayout.addSpacerItem(fixedSpacer) headerLayout.addWidget(self.__watchpointLabel) headerLayout.addSpacerItem(expandingSpacer) headerLayout.addWidget(self.__showHideButton) self.headerFrame.setLayout(headerLayout) self.__wpointsList = WatchPointView(self, wpointModel) self.__enableButton = QToolButton() self.__enableButton.setIcon(PixmapCache().getIcon('add.png')) self.__enableButton.setFixedSize(24, 24) self.__enableButton.setToolTip("Enable/disable the watchpoint") self.__enableButton.setFocusPolicy(Qt.NoFocus) self.__enableButton.setEnabled(False) self.__enableButton.clicked.connect(self.__onEnableDisable) expandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) self.__jumpToCodeButton = QToolButton() self.__jumpToCodeButton.setIcon(PixmapCache().getIcon('gotoline.png')) self.__jumpToCodeButton.setFixedSize(24, 24) self.__jumpToCodeButton.setToolTip("Jump to the code") self.__jumpToCodeButton.setFocusPolicy(Qt.NoFocus) self.__jumpToCodeButton.setEnabled(False) self.__jumpToCodeButton.clicked.connect(self.__onJumpToCode) toolbarLayout = QHBoxLayout() toolbarLayout.addWidget(self.__enableButton) toolbarLayout.addSpacerItem(expandingSpacer) toolbarLayout.addWidget(self.__jumpToCodeButton) self.connect(self.__wpointsList, SIGNAL("itemSelectionChanged()"), self.__onSelectionChanged) verticalLayout.addWidget(self.headerFrame) verticalLayout.addLayout(toolbarLayout) verticalLayout.addWidget(self.__wpointsList) return
def __createLayout(self): " Creates the widget layout " verticalLayout = QVBoxLayout(self) verticalLayout.setContentsMargins(0, 0, 0, 0) verticalLayout.setSpacing(0) self.headerFrame = QFrame() self.headerFrame.setFrameStyle(QFrame.StyledPanel) self.headerFrame.setAutoFillBackground(True) headerPalette = self.headerFrame.palette() headerBackground = headerPalette.color(QPalette.Background) headerBackground.setRgb(min(headerBackground.red() + 30, 255), min(headerBackground.green() + 30, 255), min(headerBackground.blue() + 30, 255)) headerPalette.setColor(QPalette.Background, headerBackground) self.headerFrame.setPalette(headerPalette) self.headerFrame.setFixedHeight(24) self.__excptLabel = QLabel("Ignored exception types") expandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) fixedSpacer = QSpacerItem(3, 3) self.__showHideButton = QToolButton() self.__showHideButton.setAutoRaise(True) self.__showHideButton.setIcon(PixmapCache().getIcon('less.png')) self.__showHideButton.setFixedSize(20, 20) self.__showHideButton.setToolTip("Hide ignored exceptions list") self.__showHideButton.setFocusPolicy(Qt.NoFocus) self.__showHideButton.clicked.connect(self.__onShowHide) headerLayout = QHBoxLayout() headerLayout.setContentsMargins(1, 1, 1, 1) headerLayout.addSpacerItem(fixedSpacer) headerLayout.addWidget(self.__excptLabel) headerLayout.addSpacerItem(expandingSpacer) headerLayout.addWidget(self.__showHideButton) self.headerFrame.setLayout(headerLayout) self.exceptionsList = QTreeWidget(self) self.exceptionsList.setSortingEnabled(False) self.exceptionsList.setAlternatingRowColors(True) self.exceptionsList.setRootIsDecorated(False) self.exceptionsList.setItemsExpandable(True) self.exceptionsList.setUniformRowHeights(True) self.exceptionsList.setSelectionMode(QAbstractItemView.SingleSelection) self.exceptionsList.setSelectionBehavior(QAbstractItemView.SelectRows) self.exceptionsList.setItemDelegate(NoOutlineHeightDelegate(4)) self.exceptionsList.setContextMenuPolicy(Qt.CustomContextMenu) self.exceptionsList.customContextMenuRequested.connect( self.__showContextMenu) self.exceptionsList.itemSelectionChanged.connect( self.__onSelectionChanged) self.exceptionsList.setHeaderLabels(["Exception type"]) self.__excTypeEdit = QLineEdit() self.__excTypeEdit.setFixedHeight(26) self.__excTypeEdit.textChanged.connect(self.__onNewFilterChanged) self.__excTypeEdit.returnPressed.connect(self.__onAddExceptionFilter) self.__addButton = QPushButton("Add") # self.__addButton.setFocusPolicy( Qt.NoFocus ) self.__addButton.setEnabled(False) self.__addButton.clicked.connect(self.__onAddExceptionFilter) expandingSpacer2 = QWidget() expandingSpacer2.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.__removeButton = QAction(PixmapCache().getIcon('delitem.png'), "Remove selected exception type", self) self.__removeButton.triggered.connect(self.__onRemoveFromIgnore) self.__removeButton.setEnabled(False) fixedSpacer1 = QWidget() fixedSpacer1.setFixedWidth(5) self.__removeAllButton = QAction( PixmapCache().getIcon('ignexcptdelall.png'), "Remove all the exception types", self) self.__removeAllButton.triggered.connect(self.__onRemoveAllFromIgnore) self.__removeAllButton.setEnabled(False) self.toolbar = QToolBar() self.toolbar.setOrientation(Qt.Horizontal) self.toolbar.setMovable(False) self.toolbar.setAllowedAreas(Qt.TopToolBarArea) self.toolbar.setIconSize(QSize(16, 16)) self.toolbar.setFixedHeight(28) self.toolbar.setContentsMargins(0, 0, 0, 0) self.toolbar.addWidget(expandingSpacer2) self.toolbar.addAction(self.__removeButton) self.toolbar.addWidget(fixedSpacer1) self.toolbar.addAction(self.__removeAllButton) addLayout = QHBoxLayout() addLayout.setContentsMargins(1, 1, 1, 1) addLayout.setSpacing(1) addLayout.addWidget(self.__excTypeEdit) addLayout.addWidget(self.__addButton) verticalLayout.addWidget(self.headerFrame) verticalLayout.addWidget(self.toolbar) verticalLayout.addWidget(self.exceptionsList) verticalLayout.addLayout(addLayout) return
def __init__(self, *args, **kwargs): super(ShortcutManagerDlg, self).__init__(*args, **kwargs) self.setWindowTitle("Shortcut Preferences") self.setMinimumWidth(500) self.setMinimumHeight(500) mgr = ShortcutManager() # Singleton scrollWidget = QWidget(parent=self) tempLayout = QVBoxLayout(scrollWidget) scrollWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) treeWidget = QTreeWidget(parent=scrollWidget) treeWidget.setHeaderLabels(["Action", "Shortcut"]) treeWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) treeWidget.setColumnWidth(0, 300) treeWidget.setColumnWidth(1, 50) action_descriptions = mgr.get_all_action_descriptions() target_keyseqs = mgr.get_keyseq_reversemap() # Create a LineEdit for each shortcut, # and keep track of them in a dict shortcutEdits = collections.OrderedDict() for group, targets in action_descriptions.items(): groupItem = QTreeWidgetItem(treeWidget, QStringList(group)) for (name, description) in targets: edit = QLineEdit(target_keyseqs[(group, name)]) shortcutEdits[(group, name)] = edit item = QTreeWidgetItem(groupItem, QStringList(description)) item.setText(0, description) treeWidget.setItemWidget(item, 1, edit) tempLayout.addWidget(treeWidget) # Add ok and cancel buttons buttonLayout = QHBoxLayout() cancelButton = QPushButton("Cancel") cancelButton.clicked.connect(self.reject) okButton = QPushButton("OK") okButton.clicked.connect(self.accept) okButton.setDefault(True) buttonLayout.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding)) buttonLayout.addWidget(cancelButton) buttonLayout.addWidget(okButton) tempLayout.addLayout(buttonLayout) scroll = QScrollArea(parent=self) scroll.setWidget(scrollWidget) scroll.setWidgetResizable(True) scroll.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) dlgLayout = QVBoxLayout() dlgLayout.addWidget(scroll) self.setLayout(dlgLayout) # Show the window result = self.exec_() # Did the user hit 'cancel'? if result != QDialog.Accepted: return for (group, name), edit in shortcutEdits.items(): oldKey = target_keyseqs[(group, name)] newKey = str(edit.text()) if oldKey.lower() != newKey.lower() and newKey != "": mgr.change_keyseq(group, name, oldKey, newKey) mgr.store_to_preferences()
class RecordingWidget(QWidgetWithDpi): """Widget containing main recording UI for Freeseer""" def __init__(self, parent=None): super(RecordingWidget, self).__init__(parent) icon = QIcon() icon.addPixmap(QPixmap(":/freeseer/logo.png"), QIcon.Normal, QIcon.Off) self.setWindowIcon(icon) self.resize(400, 400) self.mainLayout = QVBoxLayout() self.setLayout(self.mainLayout) self.setStyleSheet( """ QToolButton { background-color: #D1D1D1; border-style: solid; border-width: 1px; border-radius: 10px; border-color: #969696; padding: 6px; } QToolButton:pressed { background-color: #A3A2A2; border-width: 2px; border-color: #707070; } QToolButton:checked { background-color: #A3A2A2; border-width: 2px; border-color: #707070; } QToolButton:disabled { background-color: #EDEDED; border-color: #BFBDBD; } QToolButton:hover { border-width: 2px; } """ ) boldFont = QFont() boldFont.setBold(True) fontSize = self.font().pixelSize() fontUnit = "px" if fontSize == -1: # Font is set as points, not pixels. fontUnit = "pt" fontSize = self.font().pointSize() # Control bar self.controlRow = QHBoxLayout() self.mainLayout.addLayout(self.controlRow) self.recordIcon = QIcon(":/multimedia/record.png") self.stopIcon = QIcon(":/multimedia/stop.png") pauseIcon = QIcon(":/multimedia/pause.png") playIcon = QIcon(":/multimedia/play.png") self.headphoneIcon = QIcon() self.headphoneIcon.addPixmap(QPixmap(":/multimedia/headphones.png"), QIcon.Normal, QIcon.Off) self.is_recording = False self.recordButton = QToolButtonWithDpi() self.recordButton.setToolTip("Record") self.recordButton.setFixedSize(QSize(60, 40)) self.recordButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.recordButton.setIcon(self.recordIcon) self.recordButton.setEnabled(False) self.recordButton.setObjectName("recordButton") self.controlRow.addWidget(self.recordButton, 0, Qt.AlignLeft) self.connect(self.recordButton, SIGNAL("clicked()"), self.setRecordIcon) self.playButton = QToolButtonWithDpi() self.playButton.setToolTip("Play last recorded Video") self.playButton.setFixedSize(QSize(60, 40)) self.playButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.playButton.setIcon(playIcon) self.playButton.setEnabled(False) self.controlRow.addWidget(self.playButton, 0, Qt.AlignLeft) self.pauseButton = QToolButtonWithDpi() self.pauseButton.setToolTip("Pause") self.pauseButton.setIcon(pauseIcon) self.pauseButton.setFixedSize(QSize(60, 40)) self.pauseButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.pauseButton.setEnabled(False) self.pauseButton.setCheckable(True) self.controlRow.addWidget(self.pauseButton, 0, Qt.AlignLeft) self.controlRow.addSpacerItem(self.qspacer_item_with_dpi(30, 40)) self.controlRow.addStretch(1) self.standbyButton = QPushButtonWithDpi("Standby") self.standbyButton.setStyleSheet( """ QPushButton {{ color: white; background-color: #47a447; border-style: solid; border-width: 0px; border-radius: 10px; border-color: #398439; font: bold {}{}; padding: 6px; }} QPushButton:pressed {{ background-color: #3E8A3E; border-color: #327532; }} QPushButton:hover {{ border-width: 2px; }} """.format( fontSize + 3, fontUnit ) ) self.standbyButton.setToolTip("Standby") self.standbyButton.setFixedSize(QSize(180, 40)) self.standbyButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.standbyButton.setCheckable(True) self.standbyButton.setObjectName("standbyButton") self.controlRow.addWidget(self.standbyButton) self.disengageButton = QPushButtonWithDpi("Leave record-mode") self.disengageButton.setStyleSheet( """ QPushButton {{ color: white; background-color: #D14343; border-style: solid; border-width: 0px; border-radius: 10px; border-color: #B02C2C; font: bold {}{}; padding: 6px; }} QPushButton:pressed {{ background-color: #AD2B2B; border-color: #8C2929; }} QPushButton:hover {{ border-width: 2px; }} QPushButton:disabled {{ background-color: #B89E9E; }} """.format( fontSize + 3, fontUnit ) ) self.disengageButton.setToolTip("Leave record-mode") self.disengageButton.setFixedSize(QSize(180, 40)) self.disengageButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.disengageButton.setHidden(True) self.disengageButton.setObjectName("disengageButton") self.controlRow.addWidget(self.disengageButton) # Filter bar self.filterBarLayout = QVBoxLayout() self.mainLayout.addLayout(self.filterBarLayout) self.filterBarLayoutRow_1 = QHBoxLayout() self.filterBarLayout.addLayout(self.filterBarLayoutRow_1) self.eventLabel = QLabel("Event") self.eventLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.eventComboBox = QComboBox() self.eventLabel.setBuddy(self.eventComboBox) self.roomLabel = QLabel("Room") self.roomLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.roomComboBox = QComboBox() self.roomLabel.setBuddy(self.roomComboBox) self.dateLabel = QLabel("Date") self.dateLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.dateComboBox = QComboBox() self.dateLabel.setBuddy(self.dateComboBox) self.filterBarLayoutRow_1.addWidget(self.eventLabel) self.filterBarLayoutRow_1.addWidget(self.eventComboBox) self.filterBarLayoutRow_1.addWidget(self.roomLabel) self.filterBarLayoutRow_1.addWidget(self.roomComboBox) self.filterBarLayoutRow_1.addWidget(self.dateLabel) self.filterBarLayoutRow_1.addWidget(self.dateComboBox) self.filterBarLayoutRow_2 = QHBoxLayout() self.filterBarLayout.addLayout(self.filterBarLayoutRow_2) self.talkLabel = QLabel("Talk ") self.talkLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.talkComboBox = QComboBox() self.talkComboBox.setFont(boldFont) self.talkComboBox.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) self.talkComboBox.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength) self.filterBarLayoutRow_2.addWidget(self.talkLabel) self.filterBarLayoutRow_2.addWidget(self.talkComboBox) # Preview Layout self.previewLayout = QHBoxLayout() self.mainLayout.addLayout(self.previewLayout) self.previewWidget = QWidget() self.audioSlider = QSlider() self.audioSlider.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.audioSlider.setEnabled(False) self.previewLayout.addWidget(self.previewWidget) self.previewLayout.addWidget(self.audioSlider) self.statusLabel = QLabel() self.mainLayout.addWidget(self.statusLabel) # Audio Feedback Checkbox self.audioFeedbackCheckbox = QCheckBox() self.audioFeedbackCheckbox.setLayoutDirection(Qt.RightToLeft) self.audioFeedbackCheckbox.setIcon(self.headphoneIcon) self.audioFeedbackCheckbox.setToolTip("Enable Audio Feedback") self.mainLayout.addWidget(self.audioFeedbackCheckbox) def setRecordIcon(self): self.is_recording = not self.is_recording if self.is_recording: self.recordButton.setIcon(self.stopIcon) else: self.recordButton.setIcon(self.recordIcon)
class FeatureDlg(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) # init # ------------------------------------------------ self.setWindowTitle("Spatial Features") # widgets and layouts # ------------------------------------------------ self.layout = QHBoxLayout() self.setLayout(self.layout) self.tableAndViewGroupBox = QGroupBox(" Scales and Groups") self.tableAndViewGroupBox.setFlat(True) self.featureTableWidget = featureTableWidget.FeatureTableWidget() self.tableAndViewLayout = QVBoxLayout() self.tableAndViewLayout.setSizeConstraint(QLayout.SetNoConstraint) self.tableAndViewLayout.addWidget(self.featureTableWidget) self.viewAndButtonLayout = QVBoxLayout() self.preView = preView.PreView() self.viewAndButtonLayout.addWidget(self.preView) self.viewAndButtonLayout.addStretch() self.buttonsLayout = QHBoxLayout() self.memReqLabel = QLabel() self.buttonsLayout.addWidget(self.memReqLabel) self.buttonsLayout.addStretch() # Add Cancel self.cancel = QToolButton() self.cancel.setText("Cancel") self.cancel.clicked.connect(self.on_cancelClicked) self.buttonsLayout.addWidget(self.cancel) # Add OK self.ok = QToolButton() self.ok.setText("OK") self.ok.clicked.connect(self.on_okClicked) self.buttonsLayout.addWidget(self.ok) self.buttonsLayout.addSpacerItem(QSpacerItem(10, 0)) self.viewAndButtonLayout.addSpacerItem(QSpacerItem(0, 10)) self.tableAndViewGroupBox.setLayout(self.tableAndViewLayout) self.tableAndViewLayout.addLayout(self.buttonsLayout) self.layout.addWidget(self.tableAndViewGroupBox) self.layout.setContentsMargins(0, 0, 0, 0) self.tableAndViewGroupBox.setContentsMargins(4, 10, 4, 4) self.tableAndViewLayout.setContentsMargins(0, 10, 0, 0) self.featureTableWidget.brushSizeChanged.connect(self.preView.setFilledBrsuh) self.setMemReq() # methods # ------------------------------------------------ @property def selectedFeatureBoolMatrix(self): """Return the bool matrix of features that the user selected.""" return self.featureTableWidget.createSelectedFeaturesBoolMatrix() @selectedFeatureBoolMatrix.setter def selectedFeatureBoolMatrix(self, newMatrix): """Populate the table of selected features with the provided matrix.""" self.featureTableWidget.setSelectedFeatureBoolMatrix(newMatrix) def createFeatureTable(self, features, sigmas, brushNames=None): self.featureTableWidget.createTableForFeatureDlg(features, sigmas, brushNames) def setImageToPreView(self, image): self.preView.setVisible(image is not None) if image is not None: self.preView.setPreviewImage(qimage2ndarray.array2qimage(image)) def setIconsToTableWidget(self, checked, partiallyChecked, unchecked): self.featureTableWidget.itemDelegate.setCheckBoxIcons(checked, partiallyChecked, unchecked) def setMemReq(self): # featureSelectionList = self.featureTableWidget.createFeatureList() # TODO # memReq = self.ilastik.project.dataMgr.Classification.featureMgr.computeMemoryRequirement(featureSelectionList) # self.memReqLabel.setText("%8.2f MB" % memReq) pass def on_okClicked(self): # featureSelectionList = self.featureTableWidget.createFeatureList() # selectedFeatureList = self.featureTableWidget.createSelectedFeatureList() # sigmaList = self.featureTableWidget.createSigmaList() # featureMgr.ilastikFeatureGroups.newGroupScaleValues = sigmaList # featureMgr.ilastikFeatureGroups.newSelection = selectedFeatureList # res = self.parent().project.dataMgr.Classification.featureMgr.setFeatureItems(featureSelectionList) # if res is True: # self.parent().labelWidget.setBorderMargin(int(self.parent().project.dataMgr.Classification.featureMgr.maxContext)) # self.ilastik.project.dataMgr.Classification.featureMgr.computeMemoryRequirement(featureSelectionList) # self.accept() # else: # QErrorMessage.qtHandler().showMessage("Not enough Memory, please select fewer features !") # self.on_cancelClicked() self.accept() def on_cancelClicked(self): self.reject()
def __init__(self, parent=None): super(SleepTimer, self).__init__(parent) self.forceSpinBoxWidget = global_vars.configuration.get("GENERAL").get("sleeptimerdigitalspinbox") self.setStyleSheet("SleepTimer {" "background-color: rgb(76, 76, 76);" "color: rgb(240, 240, 240);" "}" "QLabel {" "color: white;" "}" "QSpinBox {" "padding-right: 10px; /* make room for the arrows */" "border-width: 3;" "}" "QSpinBox::up-button {" "width: 26px;" "}" "QSpinBox::down-button {" "width: 26px;" "}" ) self.value = 0 # the value is calculated in self.active (calculated seconds in total) self.isActive = False if self.forceSpinBoxWidget: self.sb_hours = LeadingZeroSpinBox() self.sb_hours.setRange(0,23) self.sb_hours.setAlignment(Qt.AlignCenter) self.sb_hours.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) else: self.sb_hours = QDeclarativeView() self.sb_hours.setSource(QUrl(os.path.join(cwd,'sb_hours.qml'))) self.sb_hours.setResizeMode(QDeclarativeView.SizeViewToRootObject) self.sb_hours.setStyleSheet("background:transparent;") self.sb_hours.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.sb_hours_obj = self.sb_hours.rootObject().findChild(QObject, "spinner") self.sb_hours_value = QDeclarativeProperty(self.sb_hours.rootObject().findChild(QDeclarativeItem, name="spinner"),"currentIndex") if self.forceSpinBoxWidget: self.sb_minutes = LeadingZeroSpinBox() self.sb_minutes.setRange(0,59) self.sb_minutes.setAlignment(Qt.AlignCenter) self.sb_minutes.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) else: self.sb_minutes = QDeclarativeView() self.sb_minutes.setSource(QUrl(os.path.join(cwd,'sb_minutes.qml'))) self.sb_minutes.setResizeMode(QDeclarativeView.SizeViewToRootObject) self.sb_minutes.setStyleSheet("background:transparent;") self.sb_minutes.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.sb_minutes_obj = self.sb_minutes.rootObject().findChild(QObject, "spinner") self.sb_minutes_value = QDeclarativeProperty(self.sb_minutes.rootObject().findChild(QDeclarativeItem, name="spinner"),"currentIndex") tmpFont = QFont() tmpFont.setPointSize(18) self.lbl_hours = QLabel(QString("h")) self.lbl_hours.setFont(tmpFont) self.lbl_minutes = QLabel(QString("min")) self.lbl_minutes.setFont(tmpFont) # Load QML Widget Bomb self.bomb = QDeclarativeView() self.bomb.setSource(QUrl(os.path.join(cwd,'timebomb.qml'))) self.bomb.setResizeMode(QDeclarativeView.SizeViewToRootObject) #self.bomb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.bomb.setStyleSheet("background:transparent;") self.bomb_text = QDeclarativeProperty(self.bomb.rootObject().findChild(QDeclarativeItem, name="counter_text"),"text") #setup layouts tmpLayout = QHBoxLayout() tmpLayout.addSpacerItem(QSpacerItem(40, 40, QSizePolicy.Expanding)) tmpLayout.addWidget(self.sb_hours) tmpLayout.addWidget(self.lbl_hours) tmpLayout.addWidget(self.sb_minutes) tmpLayout.addWidget(self.lbl_minutes) tmpLayout.addSpacerItem(QSpacerItem(40, 40, QSizePolicy.Expanding)) tmp2Layout = QVBoxLayout() tmp2Layout.addLayout(tmpLayout) tmp2Layout.addWidget(self.bomb) tmp2Layout.addSpacerItem(QSpacerItem(40, 40, QSizePolicy.Expanding)) self.setLayout(tmp2Layout) self.blockValueSignal = False # if this is true, valueChanged signal is not evaluated if self.forceSpinBoxWidget: self.sb_hours.valueChanged.connect(self.onValueChanged) self.sb_minutes.valueChanged.connect(self.onValueChanged) else: self.sb_hours_obj.currentIndexChanged.connect(self.onValueChanged) self.sb_minutes_obj.currentIndexChanged.connect(self.onValueChanged) # setup Timer which is started as soon as a value is changed in any of the spinboxes self.timer = QTimer() self.timer.setSingleShot(True) self.timer.setInterval(2000) # 2 seconds until timer starts automatically self.connect(self.timer, SIGNAL("timeout()"), self.activate) #setup Timer which is a second-timer. It is startet with the self.timer (see self.active) self.countDown = QTimer() self.countDown.setInterval(1000) #sec self.connect(self.countDown, SIGNAL("timeout()"), self.check)
def setup_ui(self): vbox = QVBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) vbox.setSpacing(0) self.__toolbar = QToolBar() self.__toolbar.setObjectName('custom') hbox = QHBoxLayout() vbox.addLayout(hbox) self.stack = StackedWidget() vbox.addWidget(self.stack) self._console = console_widget.ConsoleWidget() self.stack.addWidget(self._console) self._runWidget = run_widget.RunWidget() self.stack.addWidget(self._runWidget) self._web = web_render.WebRender() self.stack.addWidget(self._web) self._findInFilesWidget = find_in_files.FindInFilesWidget( self.parent()) self.stack.addWidget(self._findInFilesWidget) #Last Element in the Stacked widget self._results = results.Results(self) self.stack.addWidget(self._results) self._btnConsole = QPushButton(QIcon(":img/console"), '') self._btnConsole.setToolTip(self.tr("Console")) self._btnRun = QPushButton(QIcon(":img/play"), '') self._btnRun.setToolTip(self.tr("Output")) self._btnWeb = QPushButton(QIcon(":img/web"), '') self._btnWeb.setToolTip(self.tr("Web Preview")) self._btnFind = QPushButton(QIcon(":img/find"), '') self._btnFind.setToolTip(self.tr("Find in Files")) #Toolbar hbox.addWidget(self.__toolbar) self.__toolbar.addWidget(self._btnConsole) self.__toolbar.addWidget(self._btnRun) self.__toolbar.addWidget(self._btnWeb) self.__toolbar.addWidget(self._btnFind) self.__toolbar.addSeparator() hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding)) btn_close = QPushButton( self.style().standardIcon(QStyle.SP_DialogCloseButton), '') btn_close.setObjectName('navigation_button') btn_close.setToolTip(self.tr('F4: Show/Hide')) hbox.addWidget(btn_close) # Not Configurable Shortcuts shortEscMisc = QShortcut(QKeySequence(Qt.Key_Escape), self) self.connect(shortEscMisc, SIGNAL("activated()"), self.hide) self.connect(self._btnConsole, SIGNAL("clicked()"), lambda: self._item_changed(0)) self.connect(self._btnRun, SIGNAL("clicked()"), lambda: self._item_changed(1)) self.connect(self._btnWeb, SIGNAL("clicked()"), lambda: self._item_changed(2)) self.connect(self._btnFind, SIGNAL("clicked()"), lambda: self._item_changed(3)) self.connect(btn_close, SIGNAL('clicked()'), self.hide)
class RecordingWidget(QWidgetWithDpi): """Widget containing main recording UI for Freeseer""" def __init__(self, parent=None): super(RecordingWidget, self).__init__(parent) icon = QIcon() icon.addPixmap(QPixmap(":/freeseer/logo.png"), QIcon.Normal, QIcon.Off) self.setWindowIcon(icon) self.resize(400, 400) self.mainLayout = QVBoxLayout() self.setLayout(self.mainLayout) self.setStyleSheet(""" QToolButton { background-color: #D1D1D1; border-style: solid; border-width: 1px; border-radius: 10px; border-color: #969696; padding: 6px; } QToolButton:pressed { background-color: #A3A2A2; border-width: 2px; border-color: #707070; } QToolButton:checked { background-color: #A3A2A2; border-width: 2px; border-color: #707070; } QToolButton:disabled { background-color: #EDEDED; border-color: #BFBDBD; } QToolButton:hover { border-width: 2px; } """) boldFont = QFont() boldFont.setBold(True) fontSize = self.font().pixelSize() fontUnit = "px" if fontSize == -1: # Font is set as points, not pixels. fontUnit = "pt" fontSize = self.font().pointSize() # Control bar self.controlRow = QHBoxLayout() self.mainLayout.addLayout(self.controlRow) self.recordIcon = QIcon(":/multimedia/record.png") self.stopIcon = QIcon(":/multimedia/stop.png") pauseIcon = QIcon(":/multimedia/pause.png") playIcon = QIcon(":/multimedia/play.png") self.headphoneIcon = QIcon() self.headphoneIcon.addPixmap(QPixmap(":/multimedia/headphones.png"), QIcon.Normal, QIcon.Off) self.is_recording = False self.recordButton = QToolButtonWithDpi() self.recordButton.setToolTip("Record") self.recordButton.setFixedSize(QSize(60, 40)) self.recordButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.recordButton.setIcon(self.recordIcon) self.recordButton.setEnabled(False) self.recordButton.setObjectName("recordButton") self.controlRow.addWidget(self.recordButton, 0, Qt.AlignLeft) self.connect(self.recordButton, SIGNAL("clicked()"), self.setRecordIcon) self.playButton = QToolButtonWithDpi() self.playButton.setToolTip("Play last recorded Video") self.playButton.setFixedSize(QSize(60, 40)) self.playButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.playButton.setIcon(playIcon) self.playButton.setEnabled(False) self.controlRow.addWidget(self.playButton, 0, Qt.AlignLeft) self.pauseButton = QToolButtonWithDpi() self.pauseButton.setToolTip("Pause") self.pauseButton.setIcon(pauseIcon) self.pauseButton.setFixedSize(QSize(60, 40)) self.pauseButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.pauseButton.setEnabled(False) self.pauseButton.setCheckable(True) self.controlRow.addWidget(self.pauseButton, 0, Qt.AlignLeft) self.controlRow.addSpacerItem(self.qspacer_item_with_dpi(30, 40)) self.controlRow.addStretch(1) self.standbyButton = QPushButtonWithDpi("Standby") self.standbyButton.setStyleSheet(""" QPushButton {{ color: white; background-color: #47a447; border-style: solid; border-width: 0px; border-radius: 10px; border-color: #398439; font: bold {}{}; padding: 6px; }} QPushButton:pressed {{ background-color: #3E8A3E; border-color: #327532; }} QPushButton:hover {{ border-width: 2px; }} """.format(fontSize + 3, fontUnit)) self.standbyButton.setToolTip("Standby") self.standbyButton.setFixedSize(QSize(180, 40)) self.standbyButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.standbyButton.setCheckable(True) self.standbyButton.setObjectName("standbyButton") self.controlRow.addWidget(self.standbyButton) self.disengageButton = QPushButtonWithDpi("Leave record-mode") self.disengageButton.setStyleSheet(""" QPushButton {{ color: white; background-color: #D14343; border-style: solid; border-width: 0px; border-radius: 10px; border-color: #B02C2C; font: bold {}{}; padding: 6px; }} QPushButton:pressed {{ background-color: #AD2B2B; border-color: #8C2929; }} QPushButton:hover {{ border-width: 2px; }} QPushButton:disabled {{ background-color: #B89E9E; }} """.format(fontSize + 3, fontUnit)) self.disengageButton.setToolTip("Leave record-mode") self.disengageButton.setFixedSize(QSize(180, 40)) self.disengageButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.disengageButton.setHidden(True) self.disengageButton.setObjectName("disengageButton") self.controlRow.addWidget(self.disengageButton) # Filter bar self.filterBarLayout = QVBoxLayout() self.mainLayout.addLayout(self.filterBarLayout) self.filterBarLayoutRow_1 = QHBoxLayout() self.filterBarLayout.addLayout(self.filterBarLayoutRow_1) self.eventLabel = QLabel("Event") self.eventLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.eventComboBox = QComboBox() self.eventLabel.setBuddy(self.eventComboBox) self.roomLabel = QLabel("Room") self.roomLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.roomComboBox = QComboBox() self.roomLabel.setBuddy(self.roomComboBox) self.dateLabel = QLabel("Date") self.dateLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.dateComboBox = QComboBox() self.dateLabel.setBuddy(self.dateComboBox) self.filterBarLayoutRow_1.addWidget(self.eventLabel) self.filterBarLayoutRow_1.addWidget(self.eventComboBox) self.filterBarLayoutRow_1.addWidget(self.roomLabel) self.filterBarLayoutRow_1.addWidget(self.roomComboBox) self.filterBarLayoutRow_1.addWidget(self.dateLabel) self.filterBarLayoutRow_1.addWidget(self.dateComboBox) self.filterBarLayoutRow_2 = QHBoxLayout() self.filterBarLayout.addLayout(self.filterBarLayoutRow_2) self.talkLabel = QLabel("Talk ") self.talkLabel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.talkComboBox = QComboBox() self.talkComboBox.setFont(boldFont) self.talkComboBox.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) self.talkComboBox.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength) self.filterBarLayoutRow_2.addWidget(self.talkLabel) self.filterBarLayoutRow_2.addWidget(self.talkComboBox) # Preview Layout self.previewLayout = QHBoxLayout() self.mainLayout.addLayout(self.previewLayout) self.previewWidget = QWidget() self.audioSlider = QSlider() self.audioSlider.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) self.audioSlider.setEnabled(False) self.previewLayout.addWidget(self.previewWidget) self.previewLayout.addWidget(self.audioSlider) self.statusLabel = QLabel() self.mainLayout.addWidget(self.statusLabel) # Audio Feedback Checkbox self.audioFeedbackCheckbox = QCheckBox() self.audioFeedbackCheckbox.setLayoutDirection(Qt.RightToLeft) self.audioFeedbackCheckbox.setIcon(self.headphoneIcon) self.audioFeedbackCheckbox.setToolTip("Enable Audio Feedback") self.mainLayout.addWidget(self.audioFeedbackCheckbox) def setRecordIcon(self): self.is_recording = not self.is_recording if self.is_recording: self.recordButton.setIcon(self.stopIcon) else: self.recordButton.setIcon(self.recordIcon)
def __init__(self): super(BaseInfoPage, self).__init__() self.setTitle('工程配置') self.setSubTitle('设置工程的参数') rootLayout = QVBoxLayout() rootLayout.setContentsMargins(20, 30, 20, 30) self.project_name = "" self.project_dir = "" self.completed = False row1 = QHBoxLayout() lable1 = QLabel('工程名称:') self.et_project_name = QLineEdit() self.et_project_name.setTextMargins(-6, 0, 0, 0) self.et_project_name.textChanged.connect(self.on_text_changed) row1.addWidget(lable1) row1.addWidget(self.et_project_name) # row2 = QHBoxLayout() # lable2 = QLabel('工程位置:') # self.et_project_location = QLineEdit() # self.et_project_location.textChanged.connect(self.on_text_changed) # self.et_project_location.setReadOnly(True) # btn_location = QPushButton('...') # btn_location.setFixedWidth(50) # btn_location.clicked.connect(self.getSavePath) # row2.addWidget(lable2) # row2.addWidget(self.et_project_location) # row2.addWidget(btn_location) row3 = QHBoxLayout() lable3 = QLabel('源模板: ') self.cb_wizard_type = QComboBox() items = QStringList() for key in app.g_templates: items.append(key) self.cb_wizard_type.addItems(items) row3.addWidget(lable3) row3.addWidget(self.cb_wizard_type) row4 = QHBoxLayout() lable4 = QLabel('平台类型:') checkboxLayout = QHBoxLayout() self.cb_pt_win = QCheckBox('Win') self.cb_pt_linux = QCheckBox('Linux') checkboxLayout.addWidget(self.cb_pt_win) checkboxLayout.addWidget(self.cb_pt_linux) row4.addWidget(lable4) row4.addLayout(checkboxLayout) row6 = QHBoxLayout() self.cb_pt_version = QComboBox() items_pt_version = QStringList() items_pt_version.append('x86') items_pt_version.append('x64') self.cb_pt_version.addItems(items_pt_version) row6.addWidget(QLabel('平台级别:')) row6.addWidget(self.cb_pt_version) row5 = QHBoxLayout() lable5 = QLabel('组件类型:') self.cb_component_type = QComboBox() items_component_type = QStringList() items_component_type.append('服务') items_component_type.append('窗口') self.cb_component_type.addItems(items_component_type) self.registerField('component_type*', self.cb_component_type) self.cb_component_type.currentIndexChanged.connect( self.on_currentIndex_Changed) row5.addWidget(lable5) row5.addWidget(self.cb_component_type) space1 = QSpacerItem(40, 28, QSizePolicy.Expanding) row7 = QHBoxLayout() lable7 = QLabel('翻译文件:') self.chkb_transFile = QCheckBox() row7.addWidget(lable7) row7.addWidget(self.chkb_transFile) row7.addSpacerItem(space1) space2 = QSpacerItem(40, 28, QSizePolicy.Expanding) row8 = QHBoxLayout() lable8 = QLabel('资源文件:') self.chkb_resourceFile = QCheckBox() row8.addWidget(lable8) row8.addWidget(self.chkb_resourceFile) row8.addSpacerItem(space2) rootLayout.addLayout(row1) rootLayout.addSpacing(10) rootLayout.addLayout(row3) rootLayout.addSpacing(10) rootLayout.addLayout(row5) rootLayout.addSpacing(10) rootLayout.addLayout(row6) rootLayout.addSpacing(10) rootLayout.addLayout(row7) rootLayout.addSpacing(10) rootLayout.addLayout(row8) rootLayout.addSpacing(31) self.setLayout(rootLayout) self.setStyleSheet(styleSheet)