Ejemplo n.º 1
0
    def __init__(self, widget, parent=None):
        super(ToolDockWidget, self).__init__(parent)

        self.toolbar = None  # QToolBar()
        self.widget = None  # QWidget()

        self._spacer = None  # QSpacerItem()
        self._contents = None  # QWidget()

        self.toolbar = QToolBar(self)
        self.toolbar.setObjectName(u'toolbar')
        self.toolbar.setIconSize(QSize(22, 22))

        self.toolbar2 = QToolBar(self)
        self.toolbar2.setObjectName(u'toolbar')
        self.toolbar2.setIconSize(QSize(22, 22))
        self.toolbar2.setVisible(False)

        widget.setParent(self)
        self.widget = widget

        self._layout = QVBoxLayout(self)
        self._layout.setAlignment(Qt.AlignTop)
        self._layout.setObjectName(u'layout')
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.addWidget(self.toolbar)
        self._layout.addWidget(self.toolbar2)
        self._layout.addWidget(self.widget)

        self._contents = QWidget(self)
        self._contents.setObjectName(u'contents')
        self._contents.setLayout(self._layout)
        self.setWidget(self._contents)
Ejemplo n.º 2
0
    def createControls(self):
        self.toolBarMain = QToolBar(self)
        self.toolBarMain.addAction(self.actionChangeBackground)
        self.toolBarMain.addAction(self.actionResetBackground)
        self.toolBarMain.addAction(self.actionChangeLayout)
        self.toolBarMain.addAction(self.actionClose)
        self.toolBarMain.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.toolBarMain.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self.toolBarLayout = QToolBar(self)
        self.toolBarLayout.addAction(self.actionSelectWidgets)
        self.toolBarLayout.addAction(self.actionResetDefaultLayout)
        self.toolBarLayout.addAction(self.actionChangeLayout)
        self.toolBarLayout.addAction(self.actionClose)
        self.toolBarLayout.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.toolBarLayout.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        self.canvas = Canvas(self)
        self.layoutEditor = LayoutEditor(self)

        self.lblTitle = QLabel(self)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        self.setLayout(QVBoxLayout())
        self.layoutTop = QHBoxLayout()
        self.layoutTop.addWidget(self.lblTitle)
        self.layoutTop.addWidget(self.toolBarMain)
        self.layoutTop.addWidget(self.toolBarLayout)
        self.toolBarLayout.hide()
        self.layout().addLayout(self.layoutTop)
        self.layout().addWidget(self.canvas)
        self.layout().addWidget(self.layoutEditor)
        self.layoutEditor.hide()
Ejemplo n.º 3
0
    def initGui(self):

        for keyseq, slot in (
            (Qt.CTRL + Qt.ALT + Qt.Key_K, self.__create_group),
            (Qt.CTRL + Qt.ALT + Qt.Key_S, self.__select_next_group),
            (Qt.CTRL + Qt.ALT + Qt.Key_N, self.__next_section),
            (Qt.CTRL + Qt.ALT + Qt.Key_B, self.__previous_section),
        ):

            short = QShortcut(QKeySequence(keyseq), self.__iface.mainWindow())
            short.setContext(Qt.ApplicationShortcut)
            short.activated.connect(slot)
            self.__shortcuts.append(short)

        self.__menu = QMenu("Albion")
        self.__menu.aboutToShow.connect(self.__create_menu_entries)
        self.__iface.mainWindow().menuBar().addMenu(self.__menu)

        self.__toolbar = QToolBar("Albion")
        self.__iface.addToolBar(self.__toolbar)

        self.__toolbar.addAction(icon("log_strati.svg"),
                                 "stratigraphic log").triggered.connect(
                                     self.__log_strati_clicked)

        self.__toolbar.addWidget(self.__current_graph)
        self.__current_graph.currentIndexChanged[unicode].connect(
            self.__current_graph_changed)

        self.__toolbar.addWidget(self.__current_section)
        self.__current_section.currentIndexChanged[unicode].connect(
            self.__current_section_changed)

        self.__toolbar.addAction(
            icon("previous_line.svg"),
            "previous section  (Ctrl+Alt+b)").triggered.connect(
                self.__previous_section)

        self.__toolbar.addAction(
            icon("next_line.svg"),
            "next section (Ctrl+Alt+n)").triggered.connect(self.__next_section)

        self.__toolbar.addAction(icon("line_from_selected.svg"),
                                 "create temporary section").triggered.connect(
                                     self.__section_from_selection)

        self.__viewer3d = QDockWidget("3D")
        self.__viewer3d.setWidget(Viewer3d())
        self.__iface.addDockWidget(Qt.LeftDockWidgetArea, self.__viewer3d)
        self.__iface.mainWindow().tabifyDockWidget(
            self.__iface.mainWindow().findChild(QDockWidget, "Layers"),
            self.__viewer3d)

        self.__viewer3d_ctrl = QToolBar("3D controls")
        self.__viewer3d_ctrl.addWidget(ViewerControls(
            self.__viewer3d.widget()))
        self.__iface.addToolBar(self.__viewer3d_ctrl)

        QgsProject.instance().readProject.connect(self.__qgis__project__loaded)
        self.__qgis__project__loaded()  # case of reload
Ejemplo n.º 4
0
    def createWidgets(self):
        """
        QtWidgets creation
        """
        self.dockToolbar = QToolBar(self)
        self.dockToolbar.setStyleSheet(
            "QToolBar { border: 0px }")  # remove 3D border
        self.dockToolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        self.dockToolbarClipboard = QToolBar(self)
        self.dockToolbarClipboard.setStyleSheet(
            "QToolBar { border: 0px }")  # remove 3D border
        self.dockToolbarClipboard.setToolButtonStyle(
            Qt.ToolButtonTextUnderIcon)

        self.clipBox = QGroupBox("Clipboard")
        self.clipBox.setStyleSheet("""
                                           QGroupBox { font: normal; border: 1px solid silver; border-radius: 2px; } 
                                           QGroupBox { padding-bottom: 10px; background-color: #FAFAFA; } 
                                           QGroupBox::title { subcontrol-position: bottom center;}
                                       """)
        layoutClipBox = QHBoxLayout()
        layoutClipBox.addWidget(self.dockToolbarClipboard)
        layoutClipBox.setContentsMargins(0, 0, 0, 0)
        self.clipBox.setLayout(layoutClipBox)

        self.paramsBox = QGroupBox("Parameters")
        self.paramsBox.setStyleSheet("""
                                           QGroupBox { font: normal; border: 1px solid silver; border-radius: 2px; } 
                                           QGroupBox { padding-bottom: 10px; background-color: #FAFAFA; } 
                                           QGroupBox::title { subcontrol-position: bottom center;}
                                       """)
        layoutParamBox = QHBoxLayout()
        layoutParamBox.addWidget(self.dockToolbar)
        layoutParamBox.setContentsMargins(0, 0, 0, 0)
        self.paramsBox.setLayout(layoutParamBox)

        layoutToolbars = QHBoxLayout()
        layoutToolbars.addWidget(self.paramsBox)
        layoutToolbars.addWidget(self.clipBox)
        layoutToolbars.addStretch(1)
        layoutToolbars.setContentsMargins(5, 0, 0, 0)

        title = QLabel("Test Config:")
        title.setStyleSheet("QLabel { padding-left: 2px; padding-top: 2px }")
        font = QFont()
        font.setBold(True)
        title.setFont(font)

        layout = QVBoxLayout()
        layout.addWidget(title)
        layout.addLayout(layoutToolbars)
        layout.addWidget(self.tc)
        layout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(layout)
Ejemplo n.º 5
0
    def __init__(self, parent=None):
        super(FeatureFormWidget, self).__init__(parent)
        self.setupUi(self)

        toolbar = QToolBar()
        size = QSize(48, 48)
        toolbar.setIconSize(size)
        style = Qt.ToolButtonTextUnderIcon
        toolbar.setToolButtonStyle(style)
        self.actionDelete = toolbar.addAction(QIcon(":/icons/delete"),
                                              "Delete")
        self.actionDelete.triggered.connect(self.delete_feature)

        label = '<b style="color:red">*</b> Required fields'
        self.missingfieldsLabel = QLabel(label)
        self.missingfieldsLabel.hide()
        self.missingfieldaction = toolbar.addWidget(self.missingfieldsLabel)

        titlespacer = QWidget()
        titlespacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(titlespacer)
        self.titlellabel = QLabel(label)
        self.titlellabel.setProperty("headerlabel", True)
        self.titlelabelaction = toolbar.addWidget(self.titlellabel)

        spacer = QWidget()
        spacer2 = QWidget()
        spacer2.setMinimumWidth(40)
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        spacer2.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        toolbar.addWidget(spacer)
        self.actionCancel = toolbar.addAction(QIcon(":/icons/cancel"),
                                              "Cancel")
        toolbar.addWidget(spacer2)
        self.actionSave = toolbar.addAction(QIcon(":/icons/save"), "Save")
        self.actionSave.triggered.connect(self.save_feature)

        self.layout().setContentsMargins(0, 3, 0, 3)
        self.layout().insertWidget(0, toolbar)
        self.actiontoolbar = QToolBar()
        self.actiontoolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.actiontoolbar.addWidget(spacer)
        self.layout().insertWidget(1, self.actiontoolbar)

        self.flickwidget = FlickCharm()
        self.flickwidget.activateOn(self.scrollArea)

        self.featureform = None
        self.values = {}
        self.config = {}
        self.feature = None
Ejemplo n.º 6
0
    def __createLayout(self, parent):
        " Creates the toolbar and layout "

        # Buttons
        self.printButton = QAction(PixmapCache().getIcon('printer.png'),
                                   'Print', self)
        #printButton.setShortcut( 'Ctrl+' )
        self.printButton.triggered.connect(self.__onPrint)
        self.printButton.setVisible(False)

        self.printPreviewButton = QAction(
            PixmapCache().getIcon('printpreview.png'), 'Print preview', self)
        #printPreviewButton.setShortcut( 'Ctrl+' )
        self.printPreviewButton.triggered.connect(self.__onPrintPreview)
        self.printPreviewButton.setVisible(False)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.clearButton = QAction(PixmapCache().getIcon('trash.png'), 'Clear',
                                   self)
        self.clearButton.triggered.connect(self.__clear)

        # The toolbar
        self.toolbar = QToolBar(self)
        self.toolbar.setOrientation(Qt.Vertical)
        self.toolbar.setMovable(False)
        self.toolbar.setAllowedAreas(Qt.RightToolBarArea)
        self.toolbar.setIconSize(QSize(16, 16))
        self.toolbar.setFixedWidth(28)
        self.toolbar.setContentsMargins(0, 0, 0, 0)

        self.toolbar.addAction(self.printPreviewButton)
        self.toolbar.addAction(self.printButton)
        self.toolbar.addWidget(spacer)
        self.toolbar.addAction(self.clearButton)

        self.__resultsTree = FindResultsTreeWidget()
        self.__resultsTree.setAlternatingRowColors(True)
        self.__resultsTree.setRootIsDecorated(True)
        self.__resultsTree.setItemsExpandable(True)
        self.__resultsTree.setUniformRowHeights(True)
        self.__resultsTree.setItemDelegate(NoOutlineHeightDelegate(4))
        headerLabels = ["File name / line", "Text"]
        self.__resultsTree.setHeaderLabels(headerLabels)
        self.__resultsTree.itemActivated.connect(self.__resultActivated)
        self.__resultsTree.itemClicked.connect(self.__resultClicked)
        self.__resultsTree.setMouseTracking(True)
        self.__resultsTree.itemEntered.connect(self.__itemEntered)
        self.__resultsTree.hide()

        self.__hLayout = QHBoxLayout()
        self.__hLayout.setContentsMargins(0, 0, 0, 0)
        self.__hLayout.setSpacing(0)
        self.__hLayout.addWidget(self.toolbar)
        self.__hLayout.addWidget(self.__noneLabel)
        self.__hLayout.addWidget(self.__resultsTree)

        self.setLayout(self.__hLayout)
        return
Ejemplo n.º 7
0
   def __init__(self, rows, cols, parent = None):
      super(SpreadSheet, self).__init__(parent)

      self.toolBar = QToolBar()
      self.addToolBar(self.toolBar)
      self.formulaInput = QLineEdit()
      self.cellLabel = QLabel(self.toolBar)
      self.cellLabel.setMinimumSize(80, 0)
      self.toolBar.addWidget(self.cellLabel)
      self.toolBar.addWidget(self.formulaInput)
      self.table = QTableWidget(rows, cols, self)
      for c in range(cols):
         character = chr(ord('A') + c)
         self.table.setHorizontalHeaderItem(c, QTableWidgetItem(character))

      self.table.setItemPrototype(self.table.item(rows - 1, cols - 1))
      self.table.setItemDelegate(SpreadSheetDelegate(self))
      self.createActions()
      self.updateColor(0)
      self.setupMenuBar()
      self.setupContents()
      self.setupContextMenu()
      self.setCentralWidget(self.table)
      self.statusBar()
      self.table.currentItemChanged.connect(self.updateStatus)
      self.table.currentItemChanged.connect(self.updateColor)
      self.table.currentItemChanged.connect(self.updateLineEdit)
      self.table.itemChanged.connect(self.updateStatus)
      self.formulaInput.returnPressed.connect(self.returnPressed)
      self.table.itemChanged.connect(self.updateLineEdit)
      self.setWindowTitle("Spreadsheet")
Ejemplo n.º 8
0
    def createWidgets(self):
        """
        QtWidgets creation
        """
        self.dockToolbar = QToolBar(self)
        self.dockToolbar.setStyleSheet(
            "QToolBar { border: 0px }")  # remove 3D border

        self.imageLabel = QLabel(self)
        self.imageLabel.setBackgroundRole(QPalette.Base)
        self.imageLabel.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.imageLabel.setScaledContents(True)

        self.scrollArea = QScrollArea()
        self.scrollArea.setBackgroundRole(QPalette.Dark)
        self.scrollArea.setWidget(self.imageLabel)

        title = QLabel("Image:")
        title.setStyleSheet("QLabel { padding-left: 2px; padding-top: 2px }")
        font = QFont()
        font.setBold(True)
        title.setFont(font)

        layout = QVBoxLayout()
        layout.addWidget(title)
        layout.addWidget(self.dockToolbar)
        layout.addWidget(self.scrollArea)
        layout.setContentsMargins(2, 2, 2, 2)
        self.setLayout(layout)
Ejemplo n.º 9
0
    def test_dock(self):
        reg = global_registry()
        reg = QtWidgetRegistry(reg, parent=self.app)

        toolbox = WidgetToolBox()
        toolbox.setObjectName("widgets-toolbox")
        toolbox.setModel(reg.model())

        text = QTextEdit()
        splitter = QSplitter()
        splitter.setOrientation(Qt.Vertical)

        splitter.addWidget(toolbox)
        splitter.addWidget(text)

        dock = CollapsibleDockWidget()
        dock.setExpandedWidget(splitter)

        toolbar = QToolBar()
        toolbar.addAction("1")
        toolbar.setOrientation(Qt.Vertical)
        toolbar.setMovable(False)
        toolbar.setFloatable(False)
        dock.setCollapsedWidget(toolbar)

        dock.show()
        self.app.exec_()
Ejemplo n.º 10
0
    def _createToolbarAndConnect(self):
        """Create toolbar and connect tools."""
        self.signalMapper = QSignalMapper(self)

        self._mToolbar = QToolBar(self)
        self._mToolbar.addAction(self.actionImport)
        self._mToolbar.addAction(self.actionSave)
        self._mToolbar.addSeparator()
        self._mToolbar.addAction(self.actionSelect)
        self._mToolbar.addAction(self.actionDeselect)
        self._mToolbar.addSeparator()
        self._mToolbar.addAction(self.actionDelete)

        self.actionSave.setEnabled(False)
        self.actionSelect.setEnabled(False)
        self.actionDeselect.setEnabled(False)
        self.actionDelete.setEnabled(False)

        self.toolbarLayout.insertWidget(0, self._mToolbar)

        self.connect(self.actionImport, SIGNAL("triggered()"), self.onLoad)
        self.connect(self.actionSave, SIGNAL("triggered()"), self.onSave)
        self.connect(self.actionSelect, SIGNAL("triggered()"), self.onSelect)
        self.connect(self.actionDeselect, SIGNAL("triggered()"),
                     self.onDeselect)
        self.connect(self.actionDelete, SIGNAL("triggered()"), self.onDelete)
        self.connect(self.styleButton, SIGNAL("clicked()"), self.onStyle)
Ejemplo n.º 11
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle(self.tr("Alum Code Editor"))
        self.setMinimumSize(750,500)
        self._want_to_close = False

        #Barra de Menu TOP
        menu = self.menuBar()
        self.__crear_acciones()
        self.__crear_menu(menu)
        #Widget Cetral
        self.editor = Editor()

        self.setCentralWidget(self.editor)
        self.editor.setStyleSheet("background-color:#1e1e1e;color:white;font-size:18px;border:none;")
        self.editor.cursorPositionChanged.connect(self._actualizar_status_bar)
        #ToolBar
        self.toolbar = QToolBar()
        self.__crear_Toolbar(self.toolbar)
        self.addToolBar(Qt.LeftToolBarArea, self.toolbar)

        #satusBar
        self.status = StatusBar()
        self.setStatusBar(self.status)
        self.status.setStyleSheet("background-color:#252526;")

        #Conexiones
        self.abrir.triggered.connect(self._abrir_archivo)
        self.guardar.triggered.connect(self._guardar_archivo)
        self.nuevo.triggered.connect(self._nuevo_archivo)
Ejemplo n.º 12
0
    def __init__(self, callback):
        super().__init__()

        self.callback = callback

        #Toolbar
        toolbar = QToolBar(self)
        self.button_test = toolbar.addAction("Test script")
        self.button_burn = toolbar.addAction("Write script to ROM")
        #self.button_reload = toolbar.addAction("Refresh")
        self.button_pokescriptdoc = toolbar.addAction("PokeScript doc")
        self.button_pokescriptdoc.setToolTip(
            "Opens your webbrowser, pointing at a page where some elemnets of PokeScript are explained."
        )
        self.button_scriptdoc = toolbar.addAction("List of commands.")
        self.button_scriptdoc.setToolTip(
            "Opens a list of available commands in your default browser.")
        toolbar.actionTriggered.connect(self.toolbarAction)

        #Code editor
        sourceeditor = LNTextEdit(self)
        font = QFont("Monospace")
        font.setStyleHint(QFont.TypeWriter)
        sourceeditor.setFont(font)
        sourceeditor.setLineWrapMode(0)
        sourceeditor.setHighlighterClass(PokeScriptHighlighter)

        #Wrap it up
        layout = QVBoxLayout(self)
        layout.addWidget(toolbar)
        layout.addWidget(sourceeditor)
        layout.setContentsMargins(0, 0, 0, 0)

        #Store elements that we need later
        self.sourceeditor = sourceeditor
Ejemplo n.º 13
0
    def createDialog(self):
        """
        Create qt dialog
        """
        mainLayout = QVBoxLayout()

        self.dockToolbarComments = QToolBar(self)

        self.commentTextarea = QTextEdit()
        self.commentTextarea.setFixedHeight(150)

        self.commentsTextarea = QTextEdit()
        self.commentsTextarea.setReadOnly(True)
        self.commentsTextarea.setStyleSheet("""background-color: #EAEAEA; """)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        mainLayout.addWidget(self.dockToolbarComments)
        mainLayout.addWidget(self.commentTextarea)
        mainLayout.addWidget(self.commentsTextarea)
        mainLayout.addWidget(self.buttonBox)

        self.setLayout(mainLayout)

        self.setWindowTitle("Test Description > Comments")
        self.setFixedWidth(450)
        self.center()
Ejemplo n.º 14
0
    def __init__(self, parent):
        super(HtmlViewerWidget, self).__init__(parent)
        self.setLayout(QGridLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.view = QWebView()
        self.view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.frame = QFrame()
        self.frame.setLayout(QGridLayout())
        self.frame.layout().setContentsMargins(0, 0, 0, 0)

        self.toolbar = QToolBar()
        self.spacer = QWidget()
        self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.copyAction = self.toolbar.addAction(QIcon(":/icons/clipboard"),
                                                 "Copy Text")
        self.label = QLabel()
        self.closeAction = self.toolbar.addAction(QIcon(":/icons/cancel"),
                                                  "Close")
        self.spaceraction = self.toolbar.insertWidget(self.closeAction,
                                                      self.spacer)
        self.labelaction = self.toolbar.insertWidget(self.spaceraction,
                                                     self.label)
        self.closeAction.triggered.connect(self.close)
        self.copyAction.triggered.connect(self.copy_text)
        self.layout().addWidget(self.frame)
        self.frame.layout().addWidget(self.toolbar)
        self.frame.layout().addWidget(self.view)

        self.effect = QGraphicsOpacityEffect()
        self.label.setGraphicsEffect(self.effect)
        self.anim = QPropertyAnimation(self.effect, "opacity")
        self.anim.setDuration(2000)
        self.anim.setStartValue(1.0)
        self.anim.setEndValue(0.0)
        self.anim.setEasingCurve(QEasingCurve.OutQuad)
Ejemplo n.º 15
0
    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        self.connect(backAction, SIGNAL("triggered()"), self.textBrowser,
                     SLOT("backward()"))
        self.connect(homeAction, SIGNAL("triggered()"), self.textBrowser,
                     SLOT("home()"))
        self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                     self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("{0} Help".format(QApplication.applicationName()))
Ejemplo n.º 16
0
    def createWidgets(self):
        """
        Create qt widgets
        """
        self.toolbar = QToolBar(self)
        self.toolbar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        layout = QVBoxLayout()

        if self.toXml:
            self.txtEdit = QtHelper.RawXmlEditor(parent=self)
            self.txtEdit.setFolding(QsciScintilla.BoxedTreeFoldStyle)
            self.txtEdit.setLexer(QsciLexerXML())
            self.txtEdit.setText(self.__data)
            self.txtEdit.setUtf8(True)
            self.txtEdit.setFont(QFont("Courier", 9))
        else:
            self.txtEdit = QtHelper.RawEditor(parent=self)
            self.txtEdit.setTabStopWidth(10)
            self.txtEdit.setText(self.__data)
            self.txtEdit.setFont(QFont("Courier", 9))

        self.txtEdit.setMinimumWidth(650)
        self.txtEdit.setMinimumHeight(400)

        layout.addWidget(self.toolbar)
        layout.addWidget(self.txtEdit)
        self.setLayout(layout)
Ejemplo n.º 17
0
    def buildToolBar(self):
        self.toolBar = QToolBar()
        self.toolBar.layout().setContentsMargins(0, 0, 0, 0)

        # Reload button
        self.reloadButton = QToolButton(self.toolBar)
        self.reloadButton.setIcon(QIcon(self.reloadPixmap))
        self.reloadButton.setSizePolicy(
            QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
        self.reloadButton.setAutoRaise(True)
        self.reloadButton.setBackgroundRole(self.backgroundRole())
        self.reloadButton.setToolTip(self.str_RELOAD)
        self.connect(self.reloadButton, SIGNAL("clicked()"), self.refreshView)
        self.toolBar.addWidget(self.reloadButton)

        # Save button
        self.saveButton = QToolButton(self.toolBar)
        self.saveButton.setIcon(QIcon(self.savePixmap))
        self.saveButton.setSizePolicy(
            QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
        self.saveButton.setAutoRaise(True)
        self.saveButton.setBackgroundRole(self.backgroundRole())
        self.saveButton.setToolTip(self.str_SAVE)
        self.connect(self.saveButton, SIGNAL("clicked()"), self.saveObject)
        self.toolBar.addWidget(self.saveButton)

        self.toolBar.addSeparator()

        # Add attribute button
        self.addAttributeButton = QToolButton(self.toolBar)
        self.addAttributeButton.setIcon(QIcon(self.addPixmap))
        self.addAttributeButton.setSizePolicy(
            QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
        self.addAttributeButton.setAutoRaise(True)
        self.addAttributeButton.setBackgroundRole(self.backgroundRole())
        self.addAttributeButton.setToolTip(self.str_ADD)
        self.connect(self.addAttributeButton, SIGNAL("clicked()"),
                     self.addAttribute)
        self.toolBar.addWidget(self.addAttributeButton)

        # Delete button
        self.deleteObjectButton = QToolButton(self.toolBar)
        self.deleteObjectButton.setIcon(QIcon(self.deleteSmallPixmap))
        self.deleteObjectButton.setSizePolicy(
            QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
        self.deleteObjectButton.setAutoRaise(True)
        self.deleteObjectButton.setBackgroundRole(self.backgroundRole())
        self.deleteObjectButton.setToolTip(self.str_DELETE)
        self.connect(self.deleteObjectButton, SIGNAL("clicked()"),
                     self.deleteObject)
        self.toolBar.addWidget(self.deleteObjectButton)

        self.comboBox.setToolTip(self.str_SWITCH_VIEWS)
        self.connect(self.comboBox, SIGNAL("currentIndexChanged(int)"),
                     self.changeView)
        self.toolBar.addWidget(self.comboBox)

        self.enableToolButtons(False)
        self.layout().insertWidget(0, self.toolBar)
Ejemplo n.º 18
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.eventId = None
        self.financeId = None
        self.personId = None
        self.clientId = None
        self.mkb = None
        self.characterId = None

        self.actAdd = QtGui.QAction(QIcon(':/new/prefix1/icons/new-icon.png'),
                                    u'Добавить', self)

        self.actAdd.setObjectName('actAdd')
        self.actEdit = QtGui.QAction(
            QIcon(':/new/prefix1/icons/edit-icon.png'), u'Изменить', self)
        self.actEdit.setObjectName('actEdit')
        self.actDuplicate = QtGui.QAction(
            QIcon(':/new/prefix1/icons/duplicate-icon.png'), u'Дублировать',
            self)
        self.actDuplicate.setObjectName('actDuplicate')
        self.actDelete = QtGui.QAction(
            QIcon(':/new/prefix1/icons/delete-icon.png'), u'Удалить', self)
        self.actDelete.setObjectName('actDelete')
        self.actPrint = QtGui.QAction(
            QIcon(':/new/prefix1/icons/print-icon.png'), u'Печать', self)
        self.actPrint.setObjectName('actPrint')
        self.actAnnul = QtGui.QAction(u'Изменить статус рецепта', self)
        self.actAnnul.setObjectName('actAnnul')
        self.actDrugstore = QtGui.QAction(u'Наличие ЛС в аптеках', self)
        self.actDrugstore.setObjectName('actDrugstore')
        self.setupUi(self)

        self.toolBar = QToolBar(self)
        self.toolBar.setIconSize(QSize(24, 24))
        self.toolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self.layout().insertWidget(0, self.toolBar)
        self.toolBar.addAction(self.actAdd)
        self.toolBar.addAction(self.actEdit)
        self.toolBar.addAction(self.actDelete)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actPrint)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.actDrugstore)

        self.addModels('Items', CItemsModel(self))
        self.tblItems.setModel(self.modelItems)
        self.tblItems.setSelectionModel(self.selectionModelItems)
        self.tblItems.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.tblItems.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.connect(self.selectionModelItems,
                     QtCore.SIGNAL('currentChanged(QModelIndex, QModelIndex)'),
                     self.on_selectionModelItems_currentChanged)
        self.tblItems.createPopupMenu([self.actAnnul])
        self.connect(self.tblItems.popupMenu(), QtCore.SIGNAL('aboutToShow()'),
                     self.popupMenuAboutToShow)

        self.actEdit.setEnabled(False)
        self.actDelete.setEnabled(False)
        self.actPrint.setEnabled(False)
Ejemplo n.º 19
0
    def __init__(self):
        QWidget.__init__(self)
        IDEGeneric.__init__(self)
        self.setWindowTitle('NINJA-IDE {Ninja Is Not Just Another IDE}')
        self.setWindowIcon(QIcon(resources.images['icon']))
        self.setWindowState(Qt.WindowMaximized)
        self.setMinimumSize(700, 500)

        #Opactity
        self.opacity = 1

        #ToolBar
        self._toolbar = QToolBar()
        self._toolbar.setToolTip('Press and Drag to Move')
        styles.set_style(self._toolbar, 'toolbar-default')
        self.addToolBar(Qt.LeftToolBarArea, self._toolbar)
        self._toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly)

        #StatusBar
        self._status = StatusBar()
        self._status.hide()
        self.setStatusBar(self._status)

        #Main Widgets
        self.main = MainWindow(self)
        self.setCentralWidget(self.main)

        #Menu
        menubar = self.menuBar()
        styles.apply(menubar, 'menu')
        file_ = menubar.addMenu('&File')
        edit = menubar.addMenu('&Edit')
        view = menubar.addMenu('&View')
        project = menubar.addMenu('&Project')
        self.pluginsMenu = menubar.addMenu('P&lugins')
        about = menubar.addMenu('&About')

        #The order of the icons in the toolbar is defined by this calls
        self._menuFile = MenuFile(file_, self._toolbar, self.main)
        self._menuView = MenuView(view, self, self.main)
        self._menuEdit = MenuEdit(edit, self._toolbar, self.main, self._status)
        self._menuProject = MenuProject(project, self._toolbar, self.main)
        self._menuPlugins = MenuPlugins(self.pluginsMenu, self)
        self._menuAbout = MenuAbout(about, self.main)

        self.main.container.load_toolbar(self._toolbar)
        self.main._central.actual_tab().obtain_editor().setFocus()

        filenames, projects_path = core.cliparser.parse()

        for filename in filenames:
            self.main.open_document(filename)

        for project_path in projects_path:
            self.main.open_project_folder(project_path)

        self.connect(self.main, SIGNAL("fileSaved(QString)"),
                     self.show_status_message)
Ejemplo n.º 20
0
    def __init__(self, config_file_path, help_tool):
        QWidget.__init__(self)

        layout = QVBoxLayout()

        toolbar = QToolBar("toolbar")


        save_action = toolbar.addAction(resourceIcon("ide/disk"), "Save")
        save_action.triggered.connect(self.save)

        save_as_action = toolbar.addAction(resourceIcon("ide/save_as"), "Save As")
        save_as_action.triggered.connect(self.saveAs)

        # reload_icon = toolbar.style().standardIcon(QStyle.SP_BrowserReload)
        # reload_action = toolbar.addAction(reload_icon, "Reload")
        # reload_action.triggered.connect(self.reload)

        toolbar.addSeparator()

        toolbar.addAction(help_tool.getAction())


        stretchy_separator = QWidget()
        stretchy_separator.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(stretchy_separator)


        search = SearchBox()
        search.setMaximumWidth(200)
        search.setContentsMargins(5, 2, 5, 2)

        toolbar.addWidget(search)

        layout.addWidget(toolbar)

        self.ide_panel = IdePanel()
        layout.addWidget(self.ide_panel, 1)

        self.config_file_path = config_file_path

        with open(config_file_path) as f:
            config_file_text = f.read()

        self.highlighter = KeywordHighlighter(self.ide_panel.document())
        
        search.filterChanged.connect(self.highlighter.setSearchString)

        self.parseDefines(config_file_text)
        self.ide_panel.document().setPlainText(config_file_text)

        cursor = self.ide_panel.textCursor()
        cursor.setPosition(0)
        self.ide_panel.setTextCursor(cursor)
        self.ide_panel.setFocus()


        self.setLayout(layout)
Ejemplo n.º 21
0
Archivo: qmap.py Proyecto: s-chand/qmap
    def createToolBars(self):
        """
        Create all the needed toolbars
        """
        
        self.menutoolbar = QToolBar("Menu", self.mainwindow)
        self.menutoolbar.setMovable(False)
        self.menutoolbar.setAllowedAreas(Qt.LeftToolBarArea)
        self.mainwindow.addToolBar(Qt.LeftToolBarArea, self.menutoolbar)
        
        self.toolbar = QToolBar("QMap", self.mainwindow)
        self.mainwindow.addToolBar(Qt.TopToolBarArea, self.toolbar)
        self.toolbar.setMovable(False)

        self.editingtoolbar = FloatingToolBar("Editing", self.toolbar)
        self.extraaddtoolbar = FloatingToolBar("Extra Add Tools", self.toolbar)
        self.syncactionstoolbar = FloatingToolBar("Syncing", self.toolbar)
        self.syncactionstoolbar.setOrientation(Qt.Vertical)
Ejemplo n.º 22
0
def add_more_tool_bar():
    """
    Add a tool bar at the bottom.

    This provieds colorful command buttons for the functions usually
    hidden in the "More" button at the bottom.
    """
    try:
        mw.reviewer.more_tool_bar = QToolBar()
    except AttributeError:
        return
    # mw.reviewer.more_tool_bar.setAccessibleName('secondary tool bar')
    mw.reviewer.more_tool_bar.setObjectName('more options tool bar')
    mw.reviewer.more_tool_bar.setIconSize(QSize(24, 24))
    if netbook_version:
        mw.reviewer.more_tool_bar.setFloatable(True)
        mw.reviewer.more_tool_bar.setMovable(True)
        mw.addToolBar(Qt.RightToolBarArea, mw.reviewer.more_tool_bar)
    else:
        mw.reviewer.more_tool_bar.setFloatable(False)
        mw.reviewer.more_tool_bar.setMovable(False)
        mw.mainLayout.insertWidget(2, mw.reviewer.more_tool_bar)
    if do_gradient:
        palette = mw.reviewer.more_tool_bar.palette()
        fg = palette.color(QPalette.ButtonText)
        bg = palette.color(QPalette.Button)
        if bg.lightnessF() > fg.lightnessF():
            bgg = bg.darker(108)
            bgl = bg.darker()
        else:
            bgg = bg.lighter(105)
            bgl = bg.lighter()
        mw.reviewer.more_tool_bar.setStyleSheet(
            toolbar_gradient_form.format(bg=bg.name(),
                                         bgg=bgg.name(),
                                         bgl=bgl.name()))
    # Add the actions here
    mw.reviewer.more_tool_bar.addAction(edit_current_action)
    mw.reviewer.more_tool_bar.addAction(toggle_mark_action)
    if show_toggle_last:
        mw.reviewer.more_tool_bar.addAction(toggle_last_card_action)
    if show_mute_button:
        mw.reviewer.more_tool_bar.addAction(mute_action)
    mw.reviewer.more_tool_bar.addAction(bury_action)
    if show_suspend_card:
        mw.reviewer.more_tool_bar.addAction(suspend_card_action)
    if show_suspend_note:
        mw.reviewer.more_tool_bar.addAction(suspend_note_action)
    mw.reviewer.more_tool_bar.addAction(delete_action)
    mw.reviewer.more_tool_bar.addSeparator()
    mw.reviewer.more_tool_bar.addAction(options_action)
    mw.reviewer.more_tool_bar.addSeparator()
    mw.reviewer.more_tool_bar.addAction(replay_action)
    mw.reviewer.more_tool_bar.addAction(record_own_action)
    mw.reviewer.more_tool_bar.addAction(replay_own_action)
    more_tool_bar_off()
Ejemplo n.º 23
0
    def __createLayout(self):
        " Helper to create the viewer layout "

        self.globalsViewer = GlobalsBrowser()

        # Toolbar part - buttons
        self.definitionButton = QAction(
            PixmapCache().getIcon('definition.png'),
            'Jump to highlighted item definition', self)
        self.definitionButton.triggered.connect(self.__goToDefinition)
        self.findButton = QAction(PixmapCache().getIcon('findusage.png'),
                                  'Find highlighted item occurences', self)
        self.findButton.triggered.connect(self.__findWhereUsed)
        self.copyPathButton = QAction(
            PixmapCache().getIcon('copytoclipboard.png'),
            'Copy path to clipboard', self)
        self.copyPathButton.triggered.connect(
            self.globalsViewer.copyToClipboard)

        self.findNotUsedButton = QAction(PixmapCache().getIcon('notused.png'),
                                         'Unused global variable analysis',
                                         self)
        self.findNotUsedButton.triggered.connect(self.__findNotUsed)
        self.findNotUsedButton.setEnabled(False)

        self.toolbar = QToolBar(self)
        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.addAction(self.definitionButton)
        self.toolbar.addAction(self.findButton)
        self.toolbar.addAction(self.copyPathButton)

        filterLabel = QLabel("  Filter ")
        self.toolbar.addWidget(filterLabel)
        self.filterEdit = CDMComboBox(True, self.toolbar)
        self.filterEdit.setSizePolicy(QSizePolicy.Expanding,
                                      QSizePolicy.Expanding)
        self.filterEdit.lineEdit().setToolTip(
            "Space separated regular expressions")
        self.toolbar.addWidget(self.filterEdit)
        self.toolbar.addAction(self.findNotUsedButton)
        self.filterEdit.editTextChanged.connect(self.__filterChanged)
        self.filterEdit.itemAdded.connect(self.__filterItemAdded)
        self.filterEdit.enterClicked.connect(self.__enterInFilter)

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.addWidget(self.toolbar)
        layout.addWidget(self.globalsViewer)

        self.setLayout(layout)
        return
Ejemplo n.º 24
0
    def __createLayout(self):
        " Creates the toolbar and layout "

        # Buttons
        printButton = QAction(PixmapCache().getIcon('printer.png'), 'Print',
                              self)
        #printButton.setShortcut( 'Ctrl+' )
        printButton.triggered.connect(self.__onPrint)

        printPreviewButton = QAction( \
                PixmapCache().getIcon( 'printpreview.png' ),
                'Print preview', self )
        #printPreviewButton.setShortcut( 'Ctrl+' )
        printPreviewButton.triggered.connect(self.__onPrintPreview)

        fixedSpacer = QWidget()
        fixedSpacer.setFixedHeight(16)

        zoomInButton = QAction(PixmapCache().getIcon('zoomin.png'),
                               'Zoom in (Ctrl+=)', self)
        zoomInButton.setShortcut('Ctrl+=')
        zoomInButton.triggered.connect(self.onZoomIn)

        zoomOutButton = QAction(PixmapCache().getIcon('zoomout.png'),
                                'Zoom out (Ctrl+-)', self)
        zoomOutButton.setShortcut('Ctrl+-')
        zoomOutButton.triggered.connect(self.onZoomOut)

        zoomResetButton = QAction(PixmapCache().getIcon('zoomreset.png'),
                                  'Zoom reset (Ctrl+0)', self)
        zoomResetButton.setShortcut('Ctrl+0')
        zoomResetButton.triggered.connect(self.onZoomReset)

        # Toolbar
        toolbar = QToolBar(self)
        toolbar.setOrientation(Qt.Vertical)
        toolbar.setMovable(False)
        toolbar.setAllowedAreas(Qt.RightToolBarArea)
        toolbar.setIconSize(QSize(16, 16))
        toolbar.setFixedWidth(28)
        toolbar.setContentsMargins(0, 0, 0, 0)
        #toolbar.addAction( printPreviewButton )
        #toolbar.addAction( printButton )
        #toolbar.addWidget( fixedSpacer )
        toolbar.addAction(zoomInButton)
        toolbar.addAction(zoomOutButton)
        toolbar.addAction(zoomResetButton)

        hLayout = QHBoxLayout()
        hLayout.setContentsMargins(0, 0, 0, 0)
        hLayout.setSpacing(0)
        hLayout.addWidget(self.__viewer)
        hLayout.addWidget(toolbar)

        self.setLayout(hLayout)
        return
Ejemplo n.º 25
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.debug = False

        self.connections = {}

        self.setWindowTitle("Servers")
        #s#elf.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)

        self.mainLayout = QVBoxLayout()
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)
        self.setLayout(self.mainLayout)

        #=============================================
        ## Top Toolbar
        topBar = QToolBar()
        topBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self.mainLayout.addWidget(topBar)

        ## Add the action buttons
        topBar.addAction(Ico.icon(Ico.ServerAdd), "Add", self.on_server_add)
        self.actionServerEdit = topBar.addAction(Ico.icon(Ico.ServerEdit),
                                                 "Edit", self.on_server_edit)
        self.actionServerDelete = topBar.addAction(Ico.icon(Ico.ServerDelete),
                                                   "Delete",
                                                   self.on_server_delete)

        #=============================================
        ## Tree
        self.tree = QTreeWidget()
        self.mainLayout.addWidget(self.tree)
        self.tree.setUniformRowHeights(True)
        self.tree.setRootIsDecorated(True)

        self.tree.setHeaderLabels(["Server",
                                   "Butt"])  # set header, but hide anyway
        self.tree.header().hide()
        self.tree.header().setResizeMode(C.node, QHeaderView.Stretch)
        self.tree.setColumnWidth(C.butt, 20)

        self.connect(self.tree, SIGNAL('itemSelectionChanged()'),
                     self.on_tree_selection_changed)
        self.connect(self.tree,
                     SIGNAL('itemDoubleClicked (QTreeWidgetItem *,int)'),
                     self.on_tree_double_clicked)

        self.buttGroup = QButtonGroup(self)
        self.connect(self.buttGroup, SIGNAL("buttonClicked(QAbstractButton*)"),
                     self.on_open_server)

        self.on_tree_selection_changed()

        self.load_servers()
Ejemplo n.º 26
0
 def __init__(self, parent=None):
     super(XCommentEdit, self).__init__(parent)
     
     # define custom properties
     self._attachments = {}
     self._showAttachments = True
     
     # create toolbar
     self._toolbar = QToolBar(self)
     self._toolbar.setMovable(False)
     self._toolbar.setFixedHeight(30)
     self._toolbar.setAutoFillBackground(True)
     self._toolbar.setFocusProxy(self)
     self._toolbar.hide()
     
     # create toolbar buttons
     self._attachButton = QToolButton(self)
     self._attachButton.setIcon(QIcon(resources.find('img/attach.png')))
     self._attachButton.setToolTip('Add Attachment')
     self._attachButton.setAutoRaise(True)
     self._attachButton.setIconSize(QSize(24, 24))
     self._attachButton.setFixedSize(26, 26)
     
     self._submitButton = QPushButton(self)
     self._submitButton.setText('Submit')
     self._submitButton.setFocusProxy(self)
     
     # create attachments widget
     self._attachmentsEdit = XMultiTagEdit(self)
     self._attachmentsEdit.setAutoResizeToContents(True)
     self._attachmentsEdit.setFrameShape(XMultiTagEdit.NoFrame)
     self._attachmentsEdit.setViewMode(XMultiTagEdit.ListMode)
     self._attachmentsEdit.setEditable(False)
     self._attachmentsEdit.setFocusProxy(self)
     self._attachmentsEdit.hide()
     
     # define toolbar layout
     spacer = QWidget(self)
     spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
     
     self._attachAction = self._toolbar.addWidget(self._attachButton)
     self._toolbar.addWidget(spacer)
     self._toolbar.addWidget(self._submitButton)
     
     # set standard properties
     self.setAutoResizeToContents(True)
     self.setHint('add comment')
     self.setFocusPolicy(Qt.StrongFocus)
     self.setRequireShiftForNewLine(True)
     
     # create connections
     self._attachButton.clicked.connect(self.attachmentRequested)
     self._submitButton.clicked.connect(self.acceptText)
     self._attachmentsEdit.tagRemoved.connect(self.removeAttachment)
     self.focusChanged.connect(self.setToolbarVisible)
Ejemplo n.º 27
0
    def __init__(self, dockwidget):
        super(Browser, self).__init__(dockwidget)

        layout = QVBoxLayout(spacing=0)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        self.toolbar = tb = QToolBar()
        self.webview = QWebView(contextMenuPolicy=Qt.CustomContextMenu)
        self.chooser = QComboBox(sizeAdjustPolicy=QComboBox.AdjustToContents)
        self.search = SearchEntry(maximumWidth=200)

        layout.addWidget(self.toolbar)
        layout.addWidget(self.webview)

        ac = dockwidget.actionCollection
        ac.help_back.triggered.connect(self.webview.back)
        ac.help_forward.triggered.connect(self.webview.forward)
        ac.help_home.triggered.connect(self.showHomePage)
        ac.help_print.triggered.connect(self.slotPrint)

        self.webview.page().setNetworkAccessManager(
            lilydoc.network.accessmanager())
        self.webview.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.webview.page().linkClicked.connect(self.openUrl)
        self.webview.page().setForwardUnsupportedContent(True)
        self.webview.page().unsupportedContent.connect(self.slotUnsupported)
        self.webview.urlChanged.connect(self.slotUrlChanged)
        self.webview.customContextMenuRequested.connect(
            self.slotShowContextMenu)

        tb.addAction(ac.help_back)
        tb.addAction(ac.help_forward)
        tb.addSeparator()
        tb.addAction(ac.help_home)
        tb.addAction(ac.help_print)
        tb.addSeparator()
        tb.addWidget(self.chooser)
        tb.addWidget(self.search)

        self.chooser.activated[int].connect(self.showHomePage)
        self.search.textEdited.connect(self.slotSearchChanged)
        self.search.returnPressed.connect(self.slotSearchReturnPressed)
        dockwidget.mainwindow().iconSizeChanged.connect(
            self.updateToolBarSettings)
        dockwidget.mainwindow().toolButtonStyleChanged.connect(
            self.updateToolBarSettings)

        app.settingsChanged.connect(self.readSettings)
        self.readSettings()
        self.loadDocumentation()
        self.showInitialPage()
        app.settingsChanged.connect(self.loadDocumentation)
        app.translateUI(self)
Ejemplo n.º 28
0
    def createWidget(self):
        """
        Create qt widget
        """
        
        self.screenResolutionLabel = QLabel(self)
        self.screenTapLabel = QLabel(self)
        
        
        mobileLayout = QVBoxLayout()
        
        self.mobileDockToolbar = QToolBar(self)
        self.mobileDockToolbar.setStyleSheet("QToolBar { border: 0px }");
        self.mobileDockToolbar.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        self.mobileImageLabel = QLabel(self)
        self.mobileImageLabel.setMouseTracking(True)
        self.mobileImageLabel.installEventFilter(self)
        self.mobileImageLabel.setScaledContents(True)
        self.mobileImageLabel.mousePressEvent = self.pixelSelect

        self.refreshCheckbox = QCheckBox("Automatic Refresh", self)
        self.refreshCheckbox.setEnabled(False)
        self.refreshCheckbox.stateChanged.connect(self.onRefreshChanged)
        
        self.clickCheckbox = QCheckBox("Enable Tap", self)
        self.clickCheckbox.setEnabled(False)

        self.model = DomModel(QDomDocument(), self)
        self.mobileTreeView = QTreeView(self)
        self.mobileTreeView.setMinimumWidth(300)
        self.mobileTreeView.setModel(self.model)
        self.mobileTreeView.clicked.connect(self.onTreeViewClicked)
        
        
        header=["Attribute", "Value"]
        self.tableModel = MyTableModel(self, [], header)
        self.mobileTableView = QTableView(self)
        self.mobileTableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.mobileTableView.setModel(self.tableModel)
        self.mobileTableView.setContextMenuPolicy(Qt.CustomContextMenu)
        self.mobileTableView.customContextMenuRequested.connect( self.onContextMenuEvent )
        self.mobileTableView.setMinimumWidth(300)

        mobileViewLayout = QHBoxLayout()
        mobileViewLayout.addWidget(self.mobileImageLabel)
        mobileViewLayout.addWidget(self.mobileTreeView)
        mobileViewLayout.addWidget(self.mobileTableView)

        mobileLayout.addWidget(self.mobileDockToolbar)
        mobileLayout.addLayout(mobileViewLayout)

        
        self.setLayout(mobileLayout)
Ejemplo n.º 29
0
    def __init__(self,
                 wintitle='Plot window',
                 major_grid=True,
                 minor_grid=False,
                 toolbar=True,
                 parent=None,
                 panels=None,
                 min_plot_width=100,
                 min_plot_height=75):
        QDialog.__init__(self, parent)
        self.setWindowFlags(Qt.Window)

        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(':/Application/Main')),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.setWindowIcon(icon)

        self.major_grid = major_grid
        self.minor_grid = minor_grid
        self.min_plot_width = min_plot_width
        self.min_plot_height = min_plot_height

        # WidgetMixin copy
        PlotManager.__init__(self, main=self)

        self.main_layout = QVBoxLayout(self)
        self.color_layout = QHBoxLayout()
        self.plot_layout = QGridLayout()
        self.plot_layout.setMargin(0)
        self.plot_scroll_widget = QWidget()
        self.plot_scroll_area = QScrollArea()
        self.plot_scroll_area.setFrameShape(QFrame.NoFrame)
        self.plot_scroll_area.setWidgetResizable(True)
        self.option_layout = QHBoxLayout()

        self.plot_widget = None

        if panels is not None:
            for panel in panels:
                self.add_panel(panel)

        self.toolbar = QToolBar('Tools')
        if not toolbar:
            self.toolbar.hide()

        # Configuring widget layout
        self._setup_widget_properties(wintitle=wintitle, icon=icon)
        self._setup_widget_layout()

        # Options
        self.option_callbacks = {}
        self.legend = None
        self.axis_syncplots = {}
Ejemplo n.º 30
0
    def create_widgets(self):
        self.backAction = QAction(QIcon(":/back.png"), self.tr("&Back"), self)
        self.backAction.setShortcut(QKeySequence.Back)
        self.homeAction = QAction(QIcon(":/home.png"), self.tr("&Home"), self)
        self.homeAction.setShortcut(self.tr("Home"))
        self.pageLabel = QLabel()

        self.toolBar = QToolBar()
        self.toolBar.addAction(self.backAction)
        self.toolBar.addAction(self.homeAction)
        self.toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()