Exemplo n.º 1
0
def main():
    app = QApplication(sys.argv)

    window = QMainWindow()
    splitter = QSplitter(window)
    window.setCentralWidget(splitter)
    left_view = MouseDevicesView(window)
    left_view.checkedDevicesChanged.connect(partial(show, 'left:'))
    right_view = MouseDevicesView(window)
    right_view.checkedDevicesChanged.connect(partial(show, 'right:'))
    splitter.addWidget(left_view)
    splitter.addWidget(right_view)

    def _move_checked_state(source, dest):
        checked = source.property('checkedDevices').toPyObject()
        dest.setProperty('checkedDevices', checked)

    toolbar = window.addToolBar('Actions')
    move_selection_left = QAction(
        QIcon.fromTheme('arrow-left'), 'Moved checked state left', window,
        triggered=partial(_move_checked_state, right_view, left_view))
    move_selection_right = QAction(
        QIcon.fromTheme('arrow-right'), 'Moved checked state right', window,
        triggered=partial(_move_checked_state, left_view, right_view))
    toolbar.addAction(move_selection_left)
    toolbar.addAction(move_selection_right)

    window.show()
    app.exec_()
Exemplo n.º 2
0
    def __init__(self, parent, *args, **kwargs):
        super(FWidget, self).__init__(parent=parent, *args, **kwargs)

        self.parent = parent
        vbox = QVBoxLayout()
        editbox = QGridLayout()

        self.search_field = LineEdit()
        # self.search_field.textChanged.connect(self.search)
        self.search_field.setToolTip(u"Taper le nom ou le numéro de "
                                     u"téléphone à chercher")
        editbox.addWidget(self.search_field, 0, 0)

        search_but = Button("")
        search_but.setIcon(QIcon.fromTheme('search', QIcon('')))
        search_but.clicked.connect(self.search)
        editbox.addWidget(search_but, 0, 1)
        # self.empty = FLabel(u"")
        # editbox.addWidget(self.empty, 1, 0)

        addgroup_but = Button(u"Nouveau groupe")
        addgroup_but.setIcon(QIcon.fromTheme('document-new', QIcon('')))
        addgroup_but.clicked.connect(self.addgroup)

        self.contact_grp = Button(u"Envoyer à groupe")
        self.contact_grp.setIcon(QIcon.fromTheme('document-new', QIcon('')))
        self.contact_grp.clicked.connect(self.contact_group)
        self.contact_grp.setEnabled(False)

        editbox.addWidget(addgroup_but, 2, 0)
        editbox.addWidget(self.contact_grp, 1, 0)

        vbox.addLayout(editbox)
        self.setLayout(vbox)
Exemplo n.º 3
0
    def build_submenu(self):
        ''' build sub menu on the fly based on file path '''
        self.menu.clear()

        if self.ex_locator.get_current_project_item().isFolder is not True:
            filenam = self.ex_locator.get_current_project_item().get_full_path()
            entry = xdg_query('default', guess_type(filenam, strict=False)[0])
            if entry:
                app = entry.replace('.desktop', '')
                actions = [
                QAction(QIcon.fromTheme(app), app, self,
                    triggered=lambda: Popen([app, filenam])),
                QAction(QIcon.fromTheme('folder-open'), 'File Manager',
                    self, triggered=lambda: Popen(['xdg-open', path.dirname(filenam)]))]

                    #QAction(QIcon.fromTheme('Sublime Text 2'), 'Sublime',
                    #    self, triggered=lambda: Popen(['sublime-text', filenam])),
                    #QAction(QIcon.fromTheme('Sqliteman'), 'Sqliteman',
                    #    self, triggered=lambda: Popen(['sqliteman', filenam])),
                    #QAction(QIcon.fromTheme('Google Chrome'), 'Google Chrome',
                    #    self, triggered=lambda: Popen(['google-chrome', filenam]))
                    
                for key in usersettings.commands.keys():
                    action = QAction(QIcon.fromTheme(key), key,
                        self, triggered=lambda: Popen([usersettings.commands[key], filenam]))
                    actions.append(action)
                
                self.menu.addActions(actions)
                    
                self.menu.show()
Exemplo n.º 4
0
	def paint(self, painter, option, index):
		painter.save()
		index0 = index.sibling( index.row(), 0 )
		utype = index0.data( Qt.UserRole )

		# # set background color
		if option.state & QStyle.State_Selected:
			painter.setPen  ( Qt.NoPen )
			painter.setBrush( SceneGraphTreeItemDelegate._backgroundBrushSelected )
			painter.drawRect(option.rect)
		elif option.state & QStyle.State_MouseOver:
			painter.setPen  ( Qt.NoPen )
			painter.setBrush( SceneGraphTreeItemDelegate._backgroundBrushHovered )
			painter.drawRect(option.rect)

		rect = option.rect
		icon = QIcon( index.data( Qt.DecorationRole) )
		rect.adjust( 5, 0, 0, 0 )
		if icon and not icon.isNull():
			icon.paint( painter, rect, Qt.AlignLeft )
			rect.adjust( 22, 0, 0, 0 )
		text = index.data(Qt.DisplayRole)
		if utype == 1: #GROUP
			painter.setPen( SceneGraphTreeItemDelegate._textPenGroup )
		else:
			painter.setPen( SceneGraphTreeItemDelegate._textPen )
		painter.drawText( rect, Qt.AlignLeft | Qt.AlignVCenter, text )
		painter.restore()
Exemplo n.º 5
0
class ResultsDialog(BASE, WIDGET):

    def __init__(self):
        super(ResultsDialog, self).__init__(None)
        self.setupUi(self)

        self.keyIcon = QIcon()
        self.keyIcon.addPixmap(self.style().standardPixmap(QStyle.SP_FileIcon))

        self.tree.itemClicked.connect(self.changeResult)

        self.fillTree()

        if self.lastUrl:
            self.webView.load(self.lastUrl)

    def fillTree(self):
        elements = ProcessingResults.getResults()
        if len(elements) == 0:
            self.lastUrl = None
            return
        for element in elements:
            item = TreeResultItem(element)
            item.setIcon(0, self.keyIcon)
            self.tree.addTopLevelItem(item)
        self.lastUrl = QUrl(elements[-1].filename)

    def changeResult(self):
        item = self.tree.currentItem()
        if isinstance(item, TreeResultItem):
            url = QUrl(item.filename)
            self.webView.load(url)
Exemplo n.º 6
0
 def setOnline(self, online=True):
     if online:
         self.setIcon(QIcon.fromTheme('user-available'))
         self._sortingValue = ' ' + self.text()
     else:
         self.setIcon(QIcon.fromTheme('user-offline'))
         self._sortingValue = self.text()
Exemplo n.º 7
0
def decorate_welcome_icon(icon, background_color):
    """Return a `QIcon` with a circle shaped background.
    """
    welcome_icon = QIcon()
    sizes = [32, 48, 64, 80]
    background_color = NAMED_COLORS.get(background_color, background_color)
    background_color = QColor(background_color)
    grad = radial_gradient(background_color)
    for size in sizes:
        icon_pixmap = icon.pixmap(5 * size / 8, 5 * size / 8)
        icon_size = icon_pixmap.size()
        icon_rect = QRect(QPoint(0, 0), icon_size)

        pixmap = QPixmap(size, size)
        pixmap.fill(QColor(0, 0, 0, 0))
        p = QPainter(pixmap)
        p.setRenderHint(QPainter.Antialiasing, True)
        p.setBrush(QBrush(grad))
        p.setPen(Qt.NoPen)
        ellipse_rect = QRect(0, 0, size, size)
        p.drawEllipse(ellipse_rect)
        icon_rect.moveCenter(ellipse_rect.center())
        p.drawPixmap(icon_rect.topLeft(), icon_pixmap)
        p.end()

        welcome_icon.addPixmap(pixmap)

    return welcome_icon
Exemplo n.º 8
0
    def load(self, name, size = 128, forceCache = False):
        icon = QIcon()
        size = int(size)
        self.pixmap = QPixmap()
        if not type(name) in (list, tuple):
            name = [str(name)]
        if forceCache or self._forceCache:
            for _name in name:
                for _size in self.iconSizes:
                    if (QPixmapCache.find('$qt'+str(_name)+str(_size),
                        self.pixmap)):
                        logging.debug('Icon %s returned from cache' % _name)
                        return self.pixmap

        logging.debug('Getting icon : %s size: %s' % (','.join(name), size))
        pix = self.findIcon(name, size)
        if pix.isNull():
            for _size in self.iconSizes:
                pix = self.findIcon(name, _size)
                if not pix.isNull():
                    if size == _size:
                        return pix
                    icon.addPixmap(pix)
            if icon.isNull():
                return self.pixmap
            return icon.pixmap(QSize(size, size))
        return pix
Exemplo n.º 9
0
 def __init__(self, thread, parent):
     QDialog.__init__(self, parent)
     self.ui = Ui_PlotPreview()
     self.ui.setupUi(self)
     self.parent = parent
     icon = QIcon()
     icon.addPixmap(QPixmap(":/icons/reload.png"), QIcon.Normal, QIcon.Off)
     self.update_btn = QPushButton(icon, "Update")
     self.ui.buttonBox.addButton(self.update_btn, QDialogButtonBox.ApplyRole)
     self.update_btn.clicked.connect(self.render_image)
     self._pix = None
     self._image_list = None
     self._thread = thread
     self.scene = QGraphicsScene()
     self.scene.setSceneRect(0,0,1,1)
     self.ui.imageView.setScene(self.scene)
     self.pix_item = None
     self.ui.imageView.setEnabled(False)
     self.ui.imageView.setInteractive(False)
     self.ui.imageView.setDragMode(QGraphicsView.ScrollHandDrag)
     self.pic_w = None
     self.pic_c = None
     self.show_pic_w = None
     self.show_pic_c = None
     timer = QTimer(self)
     timer.setSingleShot(True)
     timer.setInterval(500)
     self.timer = timer
     timer.timeout.connect(self.render_image)
     if parameters.instance.use_OpenGL:
         self.ui.imageView.setViewport(QGLWidget(QGLFormat(QGL.SampleBuffers)))
Exemplo n.º 10
0
 def icon(self):
     if self.icon_name and not self._icon:
         print "Creating icon %s for %s" % (self.icon_name, self.__class__.__name__)
         icon = QIcon()
         icon.addPixmap(QPixmap(self.icon_name), QIcon.Normal, QIcon.Off)
         self.__class__._icon = icon
     return self._icon
Exemplo n.º 11
0
	def __init__(self, edit:MpCodeEdit, parent:QWidget):
		super().__init__(parent)
		self.edit = edit

		# TODO: set fixed width font?

		# update the width in real-time by monitoring doc changes
		self._prior_linecount = 0
		self.edit.document().contentsChanged.connect(self.onDocContentsChanged)
		self.onDocContentsChanged()

		# connect scrollbar events to updates on this widget
		self.edit.verticalScrollBar().valueChanged.connect(self.update)

		# connect cursor position updates to updates on this widget
		self.edit.cursorPositionChanged.connect(self.update)

		# containers for error and warning lines
		self._errors = {}
		self._warnings = {}

		# EXAMPLES:
		#self._errors[3] = "Foobar!"
		#self._warnings[6] = "Barfoo!"

		# load icons
		self._icon_error = QIcon.fromTheme("dialog-error")
		self._icon_warning = QIcon.fromTheme("dialog-warning")
Exemplo n.º 12
0
 def initialize(self, *args, **kwargs):
     " Init Main Class "
     super(Main, self).initialize(*args, **kwargs)
     self.loca = self.locator.get_service("menuApp")
     self.loca.add_action(
         QAction(
             QIcon.fromTheme("edit-select-all"),
             "PySide to PyQt",
             self,
             triggered=lambda: self.locator.get_service("editor").add_editor(
                 content=str(
                     open(
                         path.abspath(
                             QFileDialog.getOpenFileName(
                                 None, "{} - Open a PySide PY File".format(__doc__), path.expanduser("~"), "PY(*.py)"
                             )
                         ),
                         "r",
                     ).read()
                 )
                 .strip()
                 .replace("PySide", "PyQt4")
                 .replace("Signal", "pyqtSignal")
                 .replace("Slot", "pyqtSlot")
                 .replace("Property", "pyqtProperty")
                 .replace("pyside-uic", "pyuic4")
                 .replace("pyside-rcc", "pyrcc4")
                 .replace("pyside-lupdate", "pylupdate4"),
                 syntax="python",
             ),
         )
     )
     self.loca.add_action(
         QAction(
             QIcon.fromTheme("edit-select-all"),
             "PyQt to PySide",
             self,
             triggered=lambda: self.locator.get_service("editor").add_editor(
                 content=str(
                     open(
                         path.abspath(
                             QFileDialog.getOpenFileName(
                                 None, "{} - Open a PyQt 4 PY File".format(__doc__), path.expanduser("~"), "PY(*.py)"
                             )
                         ),
                         "r",
                     ).read()
                 )
                 .strip()
                 .replace("PyQt4", "PySide")
                 .replace("pyqtSignal", "Signal")
                 .replace("pyqtSlot", "Slot")
                 .replace("pyqtProperty", "Property")
                 .replace("pyuic4", "pyside-uic")
                 .replace("pyrcc4", "pyside-rcc")
                 .replace("pylupdate4", "pyside-lupdate"),
                 syntax="python",
             ),
         )
     )
Exemplo n.º 13
0
    def __init__(self):
        super(HistoryDialog, self).__init__(None)
        self.setupUi(self)

        self.groupIcon = QIcon()
        self.groupIcon.addPixmap(self.style().standardPixmap(
            QStyle.SP_DirClosedIcon), QIcon.Normal, QIcon.Off)
        self.groupIcon.addPixmap(self.style().standardPixmap(
            QStyle.SP_DirOpenIcon), QIcon.Normal, QIcon.On)

        self.keyIcon = QIcon()
        self.keyIcon.addPixmap(self.style().standardPixmap(QStyle.SP_FileIcon))

        self.clearButton = QPushButton(self.tr('Clear'))
        self.clearButton.setToolTip(self.tr('Clear history and log'))
        self.buttonBox.addButton(self.clearButton, QDialogButtonBox.ActionRole)

        self.saveButton = QPushButton(self.tr('Save As...'))
        self.saveButton.setToolTip(self.tr('Save history and log'))
        self.buttonBox.addButton(self.saveButton, QDialogButtonBox.ActionRole)

        self.tree.doubleClicked.connect(self.executeAlgorithm)
        self.tree.currentItemChanged.connect(self.changeText)
        self.clearButton.clicked.connect(self.clearLog)
        self.saveButton.clicked.connect(self.saveLog)

        self.tree.setContextMenuPolicy(Qt.CustomContextMenu)
        self.tree.customContextMenuRequested.connect(self.showPopupMenu)

        self.fillTree()
Exemplo n.º 14
0
def QIcon_from_Icon(icon):
    """ Convert the given Enaml Icon into a QIcon.

    Parameters
    ----------
    icon : Icon
        The Enaml Icon object.

    Returns
    -------
    result : QIcon
        The QIcon instance for the given Enaml icon.

    """
    qicon = QIcon()
    for icon_image in icon.images:
        image = icon_image.image
        if not image:
            continue
        mode = ICON_MODE[icon_image.mode]
        state = ICON_STATE[icon_image.state]
        qimage = get_cached_qimage(image)
        qpixmap = QPixmap.fromImage(qimage)
        qicon.addPixmap(qpixmap, mode, state)
    return qicon
Exemplo n.º 15
0
    def __init__(self, parent=None):
        super(NewTalkWidget, self).__init__(parent)

        self.resize(600, 200)

        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

        self.bottomButtonLayout = QHBoxLayout()

        self.talkDetailsWidget = TalkDetailsWidget()
        self.layout.addWidget(self.talkDetailsWidget)

        self.talkDetailsWidget.saveButton.hide()
        addIcon = QIcon.fromTheme("list-add")
        cancelIcon = QIcon.fromTheme("edit-clear")

        self.addButton = QPushButton('Add')
        self.addButton.setIcon(addIcon)
        self.cancelButton = QPushButton('Cancel')
        self.cancelButton.setIcon(cancelIcon)

        self.talkDetailsWidget.layout.addLayout(self.bottomButtonLayout, 6, 1, 1, 1)

        self.bottomButtonLayout.addWidget(self.addButton)
        self.bottomButtonLayout.addWidget(self.cancelButton)

        self.setWindowTitle("New Talk")

        self.talkDetailsWidget.enable_input_fields()
        self.talkDetailsWidget.dateEdit.setDisplayFormat('dd MMMM, yyyy')
Exemplo n.º 16
0
    def initialize(self):
        " Init Class dock "
        self.dock = QDockWidget()
        self.dock.setFeatures(QDockWidget.DockWidgetFloatable |
                              QDockWidget.DockWidgetMovable)
        self.dock.setWindowTitle(__doc__)
        self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
        self.open = QAction(QIcon.fromTheme("document-open"), 'Open DIFF', self)
        self.diff = QAction(QIcon.fromTheme("document-new"), 'Make DIFF', self)
        self.diff.triggered.connect(self.run_gui_and_get_results)
        self.save = QAction(QIcon.fromTheme("document-save"), 'Save DIFF', self)
        self.save.triggered.connect(self.save_a_diff)
        self.patc = QAction(QIcon.fromTheme("document-edit"), 'PATCH it!', self)
        self.patc.triggered.connect(lambda: QMessageBox.information(self.dock,
            __doc__, ' Sorry. This Feature is not ready yet !, thank you... '))
        QToolBar(self.dock).addActions((self.open, self.diff,
                                        self.save, self.patc))
        try:
            self.factory = KPluginLoader("komparepart").factory()
            self.part = self.factory.create(self)
            self.dock.setWidget(self.part.widget())
            self.open.triggered.connect(lambda: self.part.openUrl(KUrl(str(
                QFileDialog.getOpenFileName(self.dock, ' Open a DIFF file ',
                                        path.expanduser("~"), ';;(*.diff)')))))
        except:
            self.dock.setWidget(QLabel(""" <center> <h3>ಠ_ಠ<br>
            ERROR: Please, install Kompare and PyKDE ! </h3><br>
            <br><i> (Sorry, cant embed non-Qt Apps). </i><center>"""))

        self.misc = self.locator.get_service('misc')
        self.misc.add_widget(self.dock,
                                QIcon.fromTheme("edit-select-all"), __doc__)
Exemplo n.º 17
0
 def initialize(self):
     " Init Class dock "
     self.dock = QDockWidget()
     self.dock.setFeatures(QDockWidget.DockWidgetFloatable |
                           QDockWidget.DockWidgetMovable)
     self.dock.setWindowTitle(__doc__)
     self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
     self.boton = QPushButton(QIcon.fromTheme("media-eject"),
                              ' Open Media ', self.dock)
     try:
         self.factory = KPluginLoader("dragonpart").factory()
         self.part = self.factory.create(self)
         self.boton.clicked.connect(lambda: self.part.openUrl(KUrl(str(
             QFileDialog.getOpenFileName(self.dock, ' Open Media File ',
             path.expanduser("~"), ';;'.join(['(*.{})'.format(e) for e in
             ['ogv', 'webm', 'avi', 'mpg', 'mpeg', '3gp', 'wmv', 'mp3',
             'asf', 'dat', 'flv', 'flac', 'ogg', 'mkv', 'mov', 'swf', 'wav',
             'rm', 'm4v', 'aaf', 'mp4', 'raw', '*']]))))))
         self.dock.setWidget(self.part.widget())
     except:
         self.dock.setWidget(QLabel(""" <center> <h3>ಠ_ಠ<br>
         ERROR: Please, install Dragon Player and PyKDE ! </h3><br>
         <br><i> (Sorry, cant embed non-Qt Apps). </i>><center>"""))
     self.misc = self.locator.get_service('misc')
     self.misc.add_widget(self.dock,
                         QIcon.fromTheme("applications-multimedia"), __doc__)
Exemplo n.º 18
0
 def initialize(self):
     " Init Class dock "
     self.dock = QDockWidget()
     self.dock.setFeatures(QDockWidget.DockWidgetFloatable |
                           QDockWidget.DockWidgetMovable)
     self.dock.setWindowTitle(__doc__)
     self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
     self.boton = QPushButton(QIcon.fromTheme("document-open-recent"),
                              'Edit Track', self.dock)
     self.boton.setToolTip('Edit iCal: {}'.format(TRACK_FILE))
     try:
         self.factory = KPluginLoader("ktimetrackerpart").factory()
         self.part = self.factory.create(self)
         self.part.setReadWrite(True)
         self.part.closeUrl()
         self.part.openUrl(KUrl(str(TRACK_FILE)))
         self.boton.clicked.connect(lambda:
                         call('xdg-open {}'.format(TRACK_FILE), shell=True))
         self.dock.setWidget(self.part.widget())
     except:
         self.dock.setWidget(QLabel(""" <center> <h3>ಠ_ಠ<br>
         ERROR: Please, install kTimeTracker and PyKDE ! </h3><br>
         <br><i> (Sorry, cant embed non-Qt Apps). </i><center>"""))
     self.misc = self.locator.get_service('misc')
     self.misc.add_widget(self.dock, QIcon.fromTheme("user-away"), __doc__)
Exemplo n.º 19
0
    def __init__(self, parent=None):
        super(CommandButtons, self).__init__(parent)
        self.setWindowTitle('Unlock Talk Details')

        self.layout = QHBoxLayout()
        self.setLayout(self.layout)

        #addIcon = QIcon.fromTheme("list-add")
        importIcon = QIcon.fromTheme("document-open")
        exportIcon = QIcon.fromTheme("document-save")
        removeIcon = QIcon.fromTheme("list-remove")
        removeAllIcon = QIcon.fromTheme("window-close")

        self.importButton = QPushButton('Import')
        self.importButton.setIcon(importIcon)
        self.exportButton = QPushButton('Export')
        self.exportButton.setIcon(exportIcon)
        self.removeButton = QPushButton('Remove')
        self.removeButton.setIcon(removeIcon)
        self.removeAllButton = QPushButton('Remove All')
        self.removeAllButton.setIcon(removeAllIcon)
        self.searchLineEdit = QLineEdit()
        self.searchLineEdit.setPlaceholderText("Search...")
        self.searchIcon = QIcon.fromTheme("edit-find")
        self.searchButton = QPushButton('Search')
        self.searchButton.setIcon(self.searchIcon)
        self.layout.addWidget(self.importButton)
        self.layout.addWidget(self.exportButton)
        self.layout.addWidget(self.removeButton)
        self.layout.addWidget(self.removeAllButton)
        self.layout.addStretch()
        self.layout.addWidget(self.searchLineEdit)
        self.layout.addWidget(self.searchButton)
        self.layout.addStretch()
Exemplo n.º 20
0
	def __init__(self, obj, parent = None):
		QWidget.__init__(self, parent)
		self.prnt = obj
		self.setWindowTitle(self.prnt.tr._translate('M@il Checker : Stack'))
		self.mutex = QMutex()

		self.stack = QWidget()
		self.scroll = QScrollArea()
		self.scroll.setWidgetResizable(True)
		self.scroll.setWidget(self.stack)

		self.scrolledLayout = QVBoxLayout()
		self.buttonLayout = QHBoxLayout()
		self.stackLayout = QVBoxLayout()
		self.stackLayout.setSpacing(3)

		self.freezAllMSG = QPushButton(QIcon.fromTheme("layer-visible-on"), '')
		self.freezAllMSG.setToolTip(self.prnt.tr._translate('Freez all messages'))
		self.freezAllMSG.clicked.connect(self.freezAllMessages)
		self.clearAllMSG = QPushButton(QIcon.fromTheme("edit-clear"), '')
		self.clearAllMSG.setToolTip(self.prnt.tr._translate('Clear all messages'))
		self.clearAllMSG.clicked.connect(self.clearAllMessages)

		self.buttonLayout.addWidget(self.freezAllMSG)
		self.buttonLayout.addWidget(self.clearAllMSG)
		self.scrolledLayout.addItem(self.buttonLayout)
		self.scrolledLayout.addWidget(self.scroll)
		self.scrolledLayout.setSpacing(3)
		self.setLayout(self.scrolledLayout)

		self.setMinimumHeight(self.prnt.desktop.height()/5)
		self.setMinimumWidth(self.prnt.desktop.width()/3)
		self.stack.setStyleSheet("QWidget {background: rgba(235,240,255,0);}")
		self.MessageStack = {}
		self.checkEmpty.connect(self.checkStackContent)
Exemplo n.º 21
0
 def __init__(self, amz_files, parent=None):
     QMainWindow.__init__(self, parent)
     self.setupUi(self)
     
     loadFileIcon = QIcon.fromTheme('document-new', QIcon(QPixmap(load_icon_path)))
     downloadIcon = QIcon.fromTheme('go-down', QIcon(QPixmap(download_icon_path)))
     settingsIcon = QIcon.fromTheme('preferences-other', QIcon(QPixmap(settings_icon_path)))
     showIcon = QIcon.fromTheme('emblem-downloads', QIcon(QPixmap(show_icon_path)))
     exitIcon = QIcon.fromTheme('window-close', QIcon(QPixmap(exit_icon_path)))
     self.pythonPixmap = QPixmap(python_icon_path)
     self.pymazon_text = self.nowDownloadingLabel.text()
     
     self.actionLoadFiles.setIcon(loadFileIcon)
     self.actionDownload.setIcon(downloadIcon)
     self.actionSettings.setIcon(settingsIcon)
     self.actionShowDownloads.setIcon(showIcon)
     self.actionQuit.setIcon(exitIcon)
     self.albumArtLabel.setPixmap(self.pythonPixmap)
     
     self.settingsDialog = SettingsDialog(self)
             
     self.tree_model = None        
     self.pbardelegate = ProgressBarDelegate()
     self.treeView.setItemDelegateForColumn(1, self.pbardelegate)
     
     self.downloader = None
     self.current_album = None
     self.old_albums = []
     self.updateInfo.connect(self.update_album_info)
     self.resetInfo.connect(self.reset_displaybar_info) 
     
     if amz_files:
         self.load_new_amz_files(amz_files)               
Exemplo n.º 22
0
    def run(self):
        #TODO parse command line for addition arguments
        msmlgui.shared.msml_app = MsmlApp(add_search_path=["/home/weigl/workspace/msml/share/"])

        app = QtGui.QApplication(sys.argv)
        app.setAttribute(Qt.AA_DontShowIconsInMenus, False)

        QIcon.setThemeName("tango")

        for path in QtGui.QIcon.themeSearchPaths():
            print "%s/%s" % (path, QtGui.QIcon.themeName())

            print QIcon.hasThemeIcon("document-open")


        #TODO parse command line for open files
        frame = MSMLMainFrame()

        from path import path

        f = path("/home/weigl/workspace/msml/examples/BunnyExample/bunny.msml.xml")
        frame.open_file(f)
        frame.show()
        #    frame.save_file_as()

        #   from .helper.scene_text import scene_to_text
        #    print scene_to_text(frame.msml_model)
        sys.exit(app.exec_())
Exemplo n.º 23
0
def main() :
    try :
        nodeAddr = readAddr( sys.argv[1] )
    except :
        nodeAddr = ('208.78.96.185', 10001) # ('210.210.1.102',10001) 
    seedNodes = [nodeAddr]
    app = QApplication( sys.argv )
    icon = QIcon()
    for iconSize in [48,32,24,16] :
        icon.addPixmap( QPixmap(':/images/cspace%d.png'%iconSize) )
    app.setWindowIcon( icon )
    app.setQuitOnLastWindowClosed( False )
    reactor = Qt4Reactor()
    if not checkSettingsVersion() :
        return
    logFile = LogFile( localSettings() )
    sys.stdout = logFile
    sys.stderr = logFile
    logging.getLogger().addHandler( logging.StreamHandler() )
    initdelaygc( reactor )
    mainWin = MainWindow( seedNodes, reactor )
    mainWin.show()
    app.exec_()
    global execFileAfterExit
    if execFileAfterExit is not None :
        p = execFileAfterExit
        args = [p]
        startingDir = os.path.split( p )[0]
        spawnProcess( p, args, os.environ, startingDir, 0 )
Exemplo n.º 24
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.current_language = "en_US"
        self.uiTranslator = QTranslator()
        self.uiTranslator.load(":/languages/tr_en_US.qm")

        icon = QIcon()
        icon.addPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)

        self.layout = QGridLayout()
        self.setLayout(self.layout)

        # Left Top corner of grid, Logo
        self.logo = QLabel("Logo")
        self.logo.setPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")))
        self.layout.addWidget(self.logo, 0, 0)

        # Right Top corner of grid, Infos
        self.aboutInfo = QLabel("About Info", openExternalLinks=True)
        self.aboutInfo.setWordWrap(True)
        self.layout.addWidget(self.aboutInfo, 0, 1)

        # Right Bottom corner of grid, Close Button
        self.buttonBox = QDialogButtonBox()
        self.closeButton = self.buttonBox.addButton("Close", QDialogButtonBox.AcceptRole)
        self.layout.addWidget(self.buttonBox, 1, 1)
        self.connect(self.closeButton, SIGNAL("clicked()"), self.close)

        self.retranslate()
Exemplo n.º 25
0
    def changeSymbologySettings( self, theMapLayer, itemList ):
        if not theMapLayer:
            return

        # Remove previous symbology items
        self.takeChildren()

        # Add the name of classification field as the first symbology item
        renderer = theMapLayer.renderer()
        if renderer.name() == "Graduated Symbol" or \
            renderer.name() == "Unique Value":
            fields = theMapLayer.pendingFields()
            self.child = QTreeWidgetItem( self )
            self.child.setText( 0, fields[ renderer.classificationAttributes()[ 0 ] ].name() )
            childFont = QFont()
            childFont.setItalic( True )
            self.child.setFont( 0, childFont )

        # Add the new symbology items
        for i in range( len( itemList ) ):
            self.child = QTreeWidgetItem( self )
            self.child.setText( 0, unicode( itemList[ i ][ 0 ] ) )
            iconChild = QIcon()
            iconChild.addPixmap( itemList[ i ][ 1 ] )
            self.child.setIcon( 0, iconChild )

            childFont = QFont()
            childFont.setPointSize( 9 )
            self.child.setFont( 0, childFont )
Exemplo n.º 26
0
 def initialize(self):
     " Init Class dock "
     self.dock = QDockWidget()
     self.dock.setFeatures(QDockWidget.DockWidgetFloatable |
                           QDockWidget.DockWidgetMovable)
     self.dock.setWindowTitle(__doc__)
     self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
     self.boton = QAction(QIcon.fromTheme("list-add"), 'Open', self)
     self.saver = QAction(QIcon.fromTheme("document-save"), 'Save', self)
     self.apiss = QAction(QIcon.fromTheme("help"), 'Python API Help', self)
     QToolBar(self.dock).addActions((self.boton, self.saver, self.apiss))
     try:
         self.factory = KPluginLoader("kigpart").factory()
         self.part = self.factory.create(self)
         self.part.setReadWrite(True)
         self.boton.triggered.connect(lambda: self.part.openUrl(KUrl(str(
             QFileDialog.getOpenFileName(self.dock, ' Open Geometry Plot ',
             path.expanduser("~"),
             ';;'.join(['(*.{})'.format(e) for e in ['fig', 'kig', 'kigz',
                                                     'seg', 'fgeo']]))))))
         self.saver.triggered.connect(lambda: self.part.saveAs(KUrl(str(
             QFileDialog.getSaveFileName(self.dock, ' Save Geometry Plot ',
             path.expanduser("~"),
             ';;'.join(['(*.{})'.format(e) for e in ['kig', 'kigz', 'fig']])
         )))))
         self.apiss.triggered.connect(lambda: open_new_tab(
             'http://edu.kde.org/kig/manual/scripting-api/classObject.html'))
         self.dock.setWidget(self.part.widget())
     except:
         self.dock.setWidget(QLabel(""" <center> <h3>ಠ_ಠ<br>
         ERROR: Please, install KIG and PyKDE ! </h3><br>
         <br><i> (Sorry, cant embed non-Qt Apps). </i><center>"""))
     self.misc = self.locator.get_service('misc')
     self.misc.add_widget(self.dock,
                         QIcon.fromTheme("accessories-calculator"), __doc__)
Exemplo n.º 27
0
def getIcon(icon_name):
    icon = QIcon.fromTheme(icon_name)
    if icon.isNull():
        icon = QIcon()
        icon.addFile(':/main/images/' + icon_name + '16.png', QSize(16, 16))
        icon.addFile(':/main/images/' + icon_name + '32.png', QSize(32, 32))
    return icon
Exemplo n.º 28
0
def iconFromTheme(*names, **kwargs):
    size = kwargs["size"] if "size" in kwargs else 32
    try:
        from PyKDE4.kdeui import KIcon

        for name in names:
            if KIcon.hasThemeIcon(name):
                return KIcon(name)
    except:
        pass
    if get_desktop() == "generic":
        try:
            from gtk import icon_theme_get_default

            iconTheme = icon_theme_get_default()
            for name in names:
                iconInfo = iconTheme.lookup_icon(name, size, 0)
                if iconInfo:
                    return QIcon(iconInfo.get_filename())
        except:
            pass
    for name in names:
        if QIcon.hasThemeIcon(name):
            return QIcon(QIcon.fromTheme(name))

        return QIcon()
Exemplo n.º 29
0
            def __init__(self, executable, iconPath, parent=None):
                super(GuiApplicationLinux, self).__init__(iconPath)

                self.eventLoop = "qt"
                self.app = QApplication(sys.argv)  # this should be done before anything else
                self.executable = executable

                if QIcon.hasThemeIcon(iconPath):
                    icon = QIcon.fromTheme(iconPath)
                else:
                    icon = QIcon(iconPath)

                self.statusIcon = QSystemTrayIcon(icon, parent)
                self.menu = QMenu(parent)

                exitAction = self.menu.addAction("Exit")
                exitAction.triggered.connect(self.quit)

                self.statusIcon.setContextMenu(self.menu)

                def activate(reason):
                    if reason == QSystemTrayIcon.Trigger:
                        return self.launchExecutable()

                QObject.connect(self.statusIcon, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), activate)

                self.statusIcon.show()
Exemplo n.º 30
0
 def menuAction(menu, title, res):
     action = QAction(title, self)
     icon = QIcon()
     icon.addPixmap(QPixmap(res))
     action.setIcon(icon)
     menu.addAction(action)
     return action
Exemplo n.º 31
0
 def getIcon(self):
     return QIcon(os.path.join(pluginPath, 'images', 'otb.png'))
Exemplo n.º 32
0
 def icon(self):
     return QIcon(os.path.join(os.path.dirname(__file__), "edit.png"))
 def icon(self):
     return QIcon(os.path.join(os.path.dirname(__file__), "layer-list.png"))
Exemplo n.º 34
0
 def icon(self):
     """
     Return the icon.
     """
     return QIcon(self.__icon)
Exemplo n.º 35
0
 def test_icon_png(self):
     """Test we can click OK."""
     path = ':/plugins/LatLngInfo/icon.png'
     icon = QIcon(path)
     self.assertFalse(icon.isNull())
Exemplo n.º 36
0
 def init_groups_cmb(self):
     ds_groups = GroupsList()
     for ds_group in ds_groups.groups.itervalues():
         self.cmbGroup.addItem(QIcon(ds_group.icon),
                               self.tr(ds_group.alias), ds_group)
Exemplo n.º 37
0
    def add_action(self,
                   icon_path,
                   text,
                   callback,
                   enabled_flag=True,
                   add_to_menu=True,
                   add_to_toolbar=True,
                   status_tip=None,
                   whats_this=None,
                   parent=None):
        """Add a toolbar icon to the toolbar.

        :param icon_path: Path to the icon for this action. Can be a resource
            path (e.g. ':/plugins/foo/bar.png') or a normal file system path.
        :type icon_path: str

        :param text: Text that should be shown in menu items for this action.
        :type text: str

        :param callback: Function to be called when the action is triggered.
        :type callback: function

        :param enabled_flag: A flag indicating if the action should be enabled
            by default. Defaults to True.
        :type enabled_flag: bool

        :param add_to_menu: Flag indicating whether the action should also
            be added to the menu. Defaults to True.
        :type add_to_menu: bool

        :param add_to_toolbar: Flag indicating whether the action should also
            be added to the toolbar. Defaults to True.
        :type add_to_toolbar: bool

        :param status_tip: Optional text to show in a popup when mouse pointer
            hovers over the action.
        :type status_tip: str

        :param parent: Parent widget for the new action. Defaults None.
        :type parent: QWidget

        :param whats_this: Optional text to show in the status bar when the
            mouse pointer hovers over the action.

        :returns: The action that was created. Note that the action is also
            added to self.actions list.
        :rtype: QAction
        """

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if add_to_menu:
            self.iface.addPluginToMenu(self.menu, action)

        self.actions.append(action)

        return action
Exemplo n.º 38
0
 def __init__(self, parent):
     super().__init__(parent)
     self._icon_remove = QIcon(
         pkg_resources.resource_filename(__name__, "icons/delete.svg"))
     self._icon_scheme = QIcon(
         pkg_resources.resource_filename(__name__, "icons/scheme.svg"))
Exemplo n.º 39
0
    def __init__(self, parent=None):
        QWidget.__init__(self, 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)

        boldFont = QFont()
        boldFont.setBold(True)

        # Control bar
        self.controlRow = QHBoxLayout()
        self.mainLayout.addLayout(self.controlRow)

        self.standbyIcon = QIcon.fromTheme("system-shutdown")
        recordFallbackIcon = QIcon(":/multimedia/record.png")
        self.recordIcon = QIcon.fromTheme("media-record", recordFallbackIcon)
        stopFallbackIcon = QIcon(":/multimedia/stop.png")
        self.stopIcon = QIcon.fromTheme("media-playback-stop",
                                        stopFallbackIcon)
        self.pauseIcon = QIcon.fromTheme("media-playback-pause")
        self.resumeIcon = QIcon.fromTheme("media-playback-start")
        self.headphoneIcon = QIcon()
        self.headphoneIcon.addPixmap(QPixmap(":/multimedia/headphones.png"),
                                     QIcon.Normal, QIcon.Off)

        self.standbyPushButton = QPushButton("Standby")
        self.standbyPushButton.setToolTip("Standby")
        self.standbyPushButton.setMinimumSize(QSize(0, 40))
        self.standbyPushButton.setSizePolicy(QSizePolicy.Minimum,
                                             QSizePolicy.Fixed)
        self.standbyPushButton.setIcon(self.standbyIcon)
        self.standbyPushButton.setCheckable(True)
        self.standbyPushButton.setObjectName("standbyButton")
        self.controlRow.addWidget(self.standbyPushButton)

        self.recordPushButton = QPushButton("Record")
        self.recordPushButton.setToolTip("Record")
        self.recordPushButton.setMinimumSize(QSize(0, 40))
        self.recordPushButton.setSizePolicy(QSizePolicy.Minimum,
                                            QSizePolicy.Fixed)
        self.recordPushButton.setIcon(self.recordIcon)
        self.recordPushButton.setHidden(True)
        self.recordPushButton.setEnabled(False)
        self.recordPushButton.setCheckable(True)
        self.recordPushButton.setObjectName("recordButton")
        self.controlRow.addWidget(self.recordPushButton)
        self.connect(self.recordPushButton, SIGNAL("toggled(bool)"),
                     self.setRecordIcon)

        self.pauseToolButton = QToolButton()
        self.pauseToolButton.setText("Pause")
        self.pauseToolButton.setToolTip("Pause")
        self.pauseToolButton.setIcon(self.pauseIcon)
        self.pauseToolButton.setMinimumSize(QSize(40, 40))
        self.pauseToolButton.setSizePolicy(QSizePolicy.Maximum,
                                           QSizePolicy.Fixed)
        self.pauseToolButton.setHidden(True)
        self.pauseToolButton.setEnabled(False)
        self.pauseToolButton.setCheckable(True)
        self.controlRow.addWidget(self.pauseToolButton)
        self.connect(self.pauseToolButton, SIGNAL("toggled(bool)"),
                     self.setPauseIcon)

        playbackIcon = QIcon.fromTheme("video-x-generic")
        self.playPushButton = QPushButton()
        self.playPushButton.setText("Play Video")
        self.playPushButton.setToolTip("Play last recorded Video")
        self.playPushButton.setIcon(playbackIcon)
        self.playPushButton.setMinimumSize(QSize(40, 40))
        self.playPushButton.setMaximumSize(QSize(120, 40))
        self.playPushButton.setHidden(True)
        self.playPushButton.setEnabled(False)
        self.playPushButton.setCheckable(True)
        self.controlRow.addWidget(self.playPushButton)

        # 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)
Exemplo n.º 40
0
class QGISAlgorithmProvider(AlgorithmProvider):

    _icon = QIcon(os.path.join(pluginPath, 'images', 'qgis.png'))
    print '***** ICON', pluginPath

    def __init__(self):
        AlgorithmProvider.__init__(self)
        self.alglist = [
            SumLines(),
            PointsInPolygon(),
            PointsInPolygonWeighted(),
            PointsInPolygonUnique(),
            BasicStatisticsStrings(),
            BasicStatisticsNumbers(),
            NearestNeighbourAnalysis(),
            MeanCoords(),
            LinesIntersection(),
            UniqueValues(),
            PointDistance(),
            ReprojectLayer(),
            ExportGeometryInfo(),
            Centroids(),
            Delaunay(),
            VoronoiPolygons(),
            SimplifyGeometries(),
            DensifyGeometries(),
            DensifyGeometriesInterval(),
            MultipartToSingleparts(),
            SinglePartsToMultiparts(),
            PolygonsToLines(),
            LinesToPolygons(),
            ExtractNodes(),
            Eliminate(),
            ConvexHull(),
            FixedDistanceBuffer(),
            VariableDistanceBuffer(),
            Dissolve(),
            Difference(),
            Intersection(),
            Union(),
            Clip(),
            ExtentFromLayer(),
            RandomSelection(),
            RandomSelectionWithinSubsets(),
            SelectByLocation(),
            RandomExtract(),
            DeleteHoles(),
            RandomExtractWithinSubsets(),
            ExtractByLocation(),
            SpatialJoin(),
            RegularPoints(),
            SymmetricalDifference(),
            VectorSplit(),
            VectorGrid(),
            DeleteColumn(),
            DeleteDuplicateGeometries(),
            TextToFloat(),
            ExtractByAttribute(),
            SelectByAttribute(),
            Grid(),
            Gridify(),
            HubDistance(),
            HubLines(),
            Merge(),
            GeometryConvert(),
            AddTableField(),
            FieldsCalculator(),
            SaveSelectedFeatures(),
            JoinAttributes(),
            AutoincrementalField(),
            Explode(),
            FieldsPyculator(),
            EquivalentNumField(),
            PointsLayerFromTable(),
            StatisticsByCategories(),
            ConcaveHull(),
            Polygonize(),
            RasterLayerStatistics(),
            PointsDisplacement(),
            ZonalStatistics(),
            PointsFromPolygons(),
            PointsFromLines(),
            RandomPointsExtent(),
            RandomPointsLayer(),
            RandomPointsPolygonsFixed(),
            RandomPointsPolygonsVariable(),
            RandomPointsAlongLines(),
            PointsToPaths(),
            PostGISExecuteSQL(),
            ImportIntoPostGIS(),
            SetVectorStyle(),
            SetRasterStyle(),
            SelectByExpression(),
            HypsometricCurves(),
            SplitLinesWithLines(),
            CreateConstantRaster(),
            FieldsMapper(),
            SelectByAttributeSum()
        ]

        if hasMatplotlib:
            from VectorLayerHistogram import VectorLayerHistogram
            from RasterLayerHistogram import RasterLayerHistogram
            from VectorLayerScatterplot import VectorLayerScatterplot
            from MeanAndStdDevPlot import MeanAndStdDevPlot
            from BarPlot import BarPlot
            from PolarPlot import PolarPlot

            self.alglist.extend([
                VectorLayerHistogram(),
                RasterLayerHistogram(),
                VectorLayerScatterplot(),
                MeanAndStdDevPlot(),
                BarPlot(),
                PolarPlot(),
            ])

        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        self.alglist.extend(scripts)
        for alg in self.alglist:
            alg._icon = self._icon

    def initializeSettings(self):
        AlgorithmProvider.initializeSettings(self)

    def unload(self):
        AlgorithmProvider.unload(self)

    def getName(self):
        return 'qgis'

    def getDescription(self):
        return self.tr('QGIS geoalgorithms')

    def getIcon(self):
        return self._icon

    def _loadAlgorithms(self):
        self.algs = self.alglist

    def supportsNonFileBasedOutput(self):
        return True
Exemplo n.º 41
0
 def icon(self):
     return QIcon(QPixmap(16,16))
Exemplo n.º 42
0
 def _clear_icons(self):
     model = self.model()
     for i in range(model.rowCount()):
         model.item(i, Column.remove).setIcon(QIcon())
         model.item(i, Column.scheme).setIcon(QIcon())
Exemplo n.º 43
0
 def protect_from_harmfull_looks(self):
     if self.is_protected == False:
         self.showMessage(unicode("Koruma Modu"),
                          unicode("Nazarlardan korunuyorsunuz."))
         self.is_protected = True
         self.setIcon(QIcon("/usr/share/cnazar/data/cnazar.png"))
Exemplo n.º 44
0
    def __init__(self, parent=None):
        super(TalkDetailsWidget, self).__init__(parent)

        self.layout = QGridLayout()
        self.setLayout(self.layout)

        self.buttonLayout = QHBoxLayout()

        saveIcon = QIcon.fromTheme("document-save")
        self.saveButton = QPushButton('Save Talk')
        self.saveButton.setIcon(saveIcon)
        self.buttonLayout.addWidget(self.saveButton)

        self.layout.addLayout(self.buttonLayout, 0, 1, 1, 1)

        self.titleLabel = QLabel('Title')
        self.titleLineEdit = QLineEdit()
        self.presenterLabel = QLabel('Presenter')
        self.presenterLineEdit = QLineEdit()
        self.layout.addWidget(self.titleLabel, 1, 0, 1, 1)
        self.layout.addWidget(self.titleLineEdit, 1, 1, 1, 1)
        self.layout.addWidget(self.presenterLabel, 1, 2, 1, 1)
        self.layout.addWidget(self.presenterLineEdit, 1, 3, 1, 1)

        self.eventLabel = QLabel('Event')
        self.eventLineEdit = QLineEdit()
        self.categoryLabel = QLabel('Category')
        self.categoryLineEdit = QLineEdit()

        self.layout.addWidget(self.eventLabel, 2, 0, 1, 1)
        self.layout.addWidget(self.eventLineEdit, 2, 1, 1, 1)
        self.layout.addWidget(self.categoryLabel, 2, 2, 1, 1)
        self.layout.addWidget(self.categoryLineEdit, 2, 3, 1, 1)

        self.roomLabel = QLabel('Room')
        self.roomLineEdit = QLineEdit()
        self.dateLayout = QHBoxLayout()
        self.dateLabel = QLabel('Date')
        self.dateEdit = QDateEdit()
        currentDate = QDate()
        self.dateEdit.setDate(currentDate.currentDate())
        self.dateEdit.setCalendarPopup(True)

        self.layout.addWidget(self.roomLabel, 3, 0, 1, 1)
        self.layout.addWidget(self.roomLineEdit, 3, 1, 1, 1)
        self.dateLayout.addWidget(self.dateEdit)
        self.layout.addWidget(self.dateLabel, 3, 2, 1, 1)
        self.layout.addLayout(self.dateLayout, 3, 3, 1, 1)

        self.startTimeLayout = QHBoxLayout()
        self.startTimeLabel = QLabel('Start Time')
        self.startTimeEdit = QTimeEdit()
        self.startTimeLayout.addWidget(self.startTimeEdit)
        self.endTimeLayout = QHBoxLayout()
        self.endTimeLabel = QLabel('End Time')
        self.endTimeEdit = QTimeEdit()
        self.endTimeLayout.addWidget(self.endTimeEdit)

        self.layout.addWidget(self.startTimeLabel, 4, 0, 1, 1)
        self.layout.addLayout(self.startTimeLayout, 4, 1, 1, 1)
        self.layout.addWidget(self.endTimeLabel, 4, 2, 1, 1)
        self.layout.addLayout(self.endTimeLayout, 4, 3, 1, 1)

        self.descriptionLabel = QLabel('Description')
        self.descriptionLabel.setAlignment(Qt.AlignTop)
        self.descriptionTextEdit = QPlainTextEdit()
        self.layout.addWidget(self.descriptionLabel, 5, 0, 1, 1)
        self.layout.addWidget(self.descriptionTextEdit, 5, 1, 1, 3)
Exemplo n.º 45
0
    def init_UI(self, startn=0):
        """Create all of the widget objects required
        startn: the initial run number loaded from previous state"""
        self.centre_widget = QWidget()
        self.centre_widget.layout = QGridLayout()
        self.centre_widget.setLayout(self.centre_widget.layout)
        self.setCentralWidget(self.centre_widget)

        #### menubar at top gives options ####
        menubar = self.menuBar()

        show_windows = menubar.addMenu('Windows')
        menu_items = []
        for window_title in [
                'Image Analyser', 'Camera Status', 'Image Saver', 'TCP Server',
                'Sequence Previewer', 'Atom Checker', 'Monitor'
        ]:
            menu_items.append(QAction(window_title, self))
            menu_items[-1].triggered.connect(self.show_window)
            show_windows.addAction(menu_items[-1])

        sync_menu = menubar.addMenu('Run Settings')
        self.sync_toggle = QAction('Sync with DExTer',
                                   sync_menu,
                                   checkable=True,
                                   checked=True)
        self.sync_toggle.setChecked(True)
        self.sync_toggle.toggled.connect(self.sync_mode)
        sync_menu.addAction(self.sync_toggle)

        self.check_rois = QAction('Trigger on atoms loaded',
                                  sync_menu,
                                  checkable=True,
                                  checked=False)
        self.check_rois.setChecked(False)
        self.check_rois.setEnabled(False)  # not functional yet
        sync_menu.addAction(self.check_rois)

        reset_date = QAction('Reset date', sync_menu, checkable=False)
        reset_date.triggered.connect(self.reset_dates)
        sync_menu.addAction(reset_date)

        #### status of the master program ####
        self.status_label = QLabel('Initiating...', self)
        self.centre_widget.layout.addWidget(self.status_label, 0, 0, 1, 3)

        Dx_label = QLabel('Run #: ', self)
        self.centre_widget.layout.addWidget(Dx_label, 1, 0, 1, 1)
        self.Dx_label = QLabel(str(startn), self)
        self.centre_widget.layout.addWidget(self.Dx_label, 1, 1, 1, 1)

        # actions that can be carried out
        self.actions = QComboBox(self)
        self.actions.addItems([
            'Run sequence', 'Multirun run', 'Pause multirun',
            'Resume multirun', 'Cancel multirun', 'TCP load sequence',
            'TCP load sequence from string', 'Save DExTer sequence',
            'Cancel Python Mode', 'Resync DExTer', 'Start acquisition'
        ])
        self.actions.resize(self.actions.sizeHint())
        self.centre_widget.layout.addWidget(self.actions, 2, 0, 1, 1)

        self.action_button = QPushButton('Go', self, checkable=False)
        self.action_button.clicked[bool].connect(self.start_action)
        self.action_button.resize(self.action_button.sizeHint())
        self.centre_widget.layout.addWidget(self.action_button, 2, 1, 1, 1)

        # text box to allow user to specify DExTer sequence file
        _, self.seq_edit = self.make_label_edit('DExTer sequence file: ',
                                                self.centre_widget.layout,
                                                position=[3, 0, 1, 1])
        # button to load sequence location from file browser
        self.seq_browse = QPushButton('Browse', self, checkable=False)
        self.seq_browse.clicked[bool].connect(self.browse_sequence)
        self.seq_browse.resize(self.seq_browse.sizeHint())
        self.centre_widget.layout.addWidget(self.seq_browse, 3, 2, 1, 1)

        #### choose main window position, dimensions: (xpos,ypos,width,height)
        self.setGeometry(*self.stats['MasterGeometry'])
        self.setWindowTitle('PyDex Master')
        self.setWindowIcon(QIcon('docs/pydexicon.png'))
Exemplo n.º 46
0
 def release_from_harmfull_looks(self):
     if self.is_protected == True:
         self.showMessage(unicode("Korumasız Mod"),
                          unicode("Nazarlardan korunma BIRAKILIYOR."))
         self.is_protected = False
         self.setIcon(QIcon("/usr/share/cnazar/data/cnazar2.png"))
 def test_icon_png(self):
     """Test we can click OK."""
     path = ':/plugins/CityExplorer/icon.png'
     icon = QIcon(path)
     self.assertFalse(icon.isNull())
Exemplo n.º 48
0
    def __init__(self, iface, db, parent=None):
        QDialog.__init__(self, parent)
        self.iface = iface
        self.db = db
        self.setupUi(self)
        self.setWindowTitle(
            u"%s - %s [%s]" %
            (self.windowTitle(), db.connection().connectionName(),
             db.connection().typeNameString()))

        self.defaultLayerName = 'QueryLayer'

        settings = QSettings()
        self.restoreGeometry(
            settings.value("/DB_Manager/sqlWindow/geometry",
                           QByteArray(),
                           type=QByteArray))

        self.editSql.setFocus()
        self.editSql.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.initCompleter()

        # allow to copy results
        copyAction = QAction("copy", self)
        self.viewResult.addAction(copyAction)
        copyAction.setShortcuts(QKeySequence.Copy)
        QObject.connect(copyAction, SIGNAL("triggered()"),
                        self.copySelectedResults)

        self.connect(self.btnExecute, SIGNAL("clicked()"), self.executeSql)
        self.connect(self.btnClear, SIGNAL("clicked()"), self.clearSql)
        self.connect(self.buttonBox.button(QDialogButtonBox.Close),
                     SIGNAL("clicked()"), self.close)

        self.connect(self.presetStore, SIGNAL("clicked()"), self.storePreset)
        self.connect(self.presetDelete, SIGNAL("clicked()"), self.deletePreset)
        self.connect(self.presetCombo, SIGNAL("activated(QString)"),
                     self.loadPreset)
        self.connect(self.presetCombo, SIGNAL("activated(QString)"),
                     self.presetName.setText)
        self.updatePresetsCombobox()

        # hide the load query as layer if feature is not supported
        self._loadAsLayerAvailable = self.db.connector.hasCustomQuerySupport()
        self.loadAsLayerGroup.setVisible(self._loadAsLayerAvailable)
        if self._loadAsLayerAvailable:
            self.layerTypeWidget.hide()  # show if load as raster is supported
            self.connect(self.loadLayerBtn, SIGNAL("clicked()"),
                         self.loadSqlLayer)
            self.connect(self.getColumnsBtn, SIGNAL("clicked()"),
                         self.fillColumnCombos)
            self.connect(self.loadAsLayerGroup, SIGNAL("toggled(bool)"),
                         self.loadAsLayerToggled)
            self.loadAsLayerToggled(False)

        self._createViewAvailable = self.db.connector.hasCreateSpatialViewSupport(
        )
        self.btnCreateView.setVisible(self._createViewAvailable)
        if self._createViewAvailable:
            self.connect(self.btnCreateView, SIGNAL("clicked()"),
                         self.createView)

        self.queryBuilderFirst = True
        self.queryBuilderBtn.setIcon(QIcon(":/db_manager/icons/sql.gif"))
        self.connect(self.queryBuilderBtn, SIGNAL("clicked()"),
                     self.displayQueryBuilder)
Exemplo n.º 49
0
	def addActions(self, target, acitons):

		'''Add actions to tool bars or menus'''
		for action in actions:
			if action is None:
				target.addSeparator()
			else:
				target.addActions(action)

	def editAction(self, action, slot=None, shortcut=None, icon=None, tip=None, checkable=False
			signal='triggered()'):

		'''Add attributes to Actions that have not been generated by the QtDesigner.'''
		if icon is not None:
			action.setIcon(QIcon(':/{0}.png'.format(icon)))
		if shortcut is not None:
			action.setShortcut(shortcut)
		if tip is not None:
			action.setToopTip(tip)
			action.setStatusTip(tip)
		if slot is not None:
#			self.connect(action, SIGNAL(signal), slot)
			action.triggered.connect(slot)
		if checkable:
			action.setCheckable(True)
		return action

	def fileNew(self):

		'''Clear the editor window for a new file with name specified in fileSaveAs method.'''
Exemplo n.º 50
0
    def __init__(self, parent):
        super(ProjectExecution, self).__init__()
        self._parent = parent
        grid = QGridLayout(self)

        grid.addWidget(QLabel(translations.TR_PROJECT_MAIN_FILE), 0, 0)
        self.path = QLineEdit()
        self.path.setPlaceholderText(
            os.path.join(os.path.expanduser("~"), 'path', 'to', 'main.py'))
        ui_tools.LineEditButton(
            self.path, self.path.clear,
            self.style().standardPixmap(self.style().SP_TrashIcon))
        self.path.setText(self._parent.project.main_file)
        self.path.setReadOnly(True)
        self.btnBrowse = QPushButton(QIcon(
            self.style().standardPixmap(self.style().SP_FileIcon)), '')
        grid.addWidget(self.path, 0, 1)
        grid.addWidget(self.btnBrowse, 0, 2)

        # this should be changed, and ALL pythonPath names to
        # python_custom_interpreter or something like that. this is NOT the
        # PYTHONPATH
        self.txtPythonInterpreter = QLineEdit()
        self.txtPythonInterpreter.setText(self._parent.project.python_exec)
        self.txtPythonInterpreter.setCompleter(QCompleter(
            ('python', 'python2', 'python3', 'python.exe', 'pythonw.exe')))
        self.txtPythonInterpreter.setPlaceholderText("python")
        self.btnPythonPath = QPushButton(QIcon(":img/open"), '')
        grid.addWidget(QLabel(
            translations.TR_PROJECT_PYTHON_INTERPRETER), 1, 0)
        grid.addWidget(self.txtPythonInterpreter, 1, 1)
        grid.addWidget(self.btnPythonPath, 1, 2)

        grid.addWidget(QLabel(translations.TR_PROJECT_PYTHON_PATH), 2, 0)
        self.txtPythonPath = QPlainTextEdit()  # TODO : better widget
        self.txtPythonPath.setPlainText(self._parent.project.python_path)
        self.txtPythonPath.setToolTip(translations.TR_PROJECT_PATH_PER_LINE)
        grid.addWidget(self.txtPythonPath, 2, 1)

        # Additional builtins/globals for pyflakes
        grid.addWidget(QLabel(translations.TR_PROJECT_BUILTINS), 3, 0)
        self.additional_builtins = QLineEdit()
        self.additional_builtins.setText(
            ' '.join(self._parent.project.additional_builtins))
        self.additional_builtins.setToolTip(
            translations.TR_PROJECT_BUILTINS_TOOLTIP)
        grid.addWidget(self.additional_builtins, 3, 1)

        self.txtPreExec = QLineEdit()
        ui_tools.LineEditButton(
            self.txtPreExec, self.txtPreExec.clear,
            self.style().standardPixmap(self.style().SP_TrashIcon))
        self.txtPreExec.setReadOnly(True)
        self.txtPreExec.setText(self._parent.project.pre_exec_script)
        self.txtPreExec.setPlaceholderText(
            os.path.join(os.path.expanduser("~"), 'path', 'to', 'script.sh'))
        self.btnPreExec = QPushButton(QIcon(":img/open"), '')
        grid.addWidget(QLabel(translations.TR_PROJECT_PRE_EXEC), 4, 0)
        grid.addWidget(self.txtPreExec, 4, 1)
        grid.addWidget(self.btnPreExec, 4, 2)
        self.txtPostExec = QLineEdit()
        ui_tools.LineEditButton(
            self.txtPostExec, self.txtPostExec.clear,
            self.style().standardPixmap(self.style().SP_TrashIcon))
        self.txtPostExec.setReadOnly(True)
        self.txtPostExec.setText(self._parent.project.post_exec_script)
        self.txtPostExec.setPlaceholderText(
            os.path.join(os.path.expanduser("~"), 'path', 'to', 'script.sh'))
        self.btnPostExec = QPushButton(QIcon(":img/open"), '')
        grid.addWidget(QLabel(translations.TR_PROJECT_POST_EXEC), 5, 0)
        grid.addWidget(self.txtPostExec, 5, 1)
        grid.addWidget(self.btnPostExec, 5, 2)

        grid.addItem(QSpacerItem(5, 10, QSizePolicy.Expanding,
                     QSizePolicy.Expanding), 6, 0)

        # Properties
        grid.addWidget(QLabel(translations.TR_PROJECT_PROPERTIES), 7, 0)
        self.txtParams = QLineEdit()
        self.txtParams.setToolTip(translations.TR_PROJECT_PARAMS_TOOLTIP)
        self.txtParams.setText(self._parent.project.program_params)
        self.txtParams.setPlaceholderText('verbose, debug, force')
        grid.addWidget(QLabel(translations.TR_PROJECT_PARAMS), 8, 0)
        grid.addWidget(self.txtParams, 8, 1)
        #Widgets for virtualenv properties
        self.txtVenvPath = QLineEdit()
        ui_tools.LineEditButton(
            self.txtVenvPath, self.txtVenvPath.clear,
            self.style().standardPixmap(self.style().SP_TrashIcon))
        self.txtVenvPath.setText(self._parent.project.venv)
        self._dir_completer = QCompleter()
        self._dir_completer.setModel(QDirModel(self._dir_completer))
        self.txtVenvPath.setCompleter(self._dir_completer)
        self.txtVenvPath.setPlaceholderText(
            os.path.join(os.path.expanduser("~"), 'path', 'to', 'virtualenv'))
        self.btnVenvPath = QPushButton(QIcon(":img/open"), '')
        grid.addWidget(QLabel(translations.TR_PROJECT_VIRTUALENV), 9, 0)
        grid.addWidget(self.txtVenvPath, 9, 1)
        grid.addWidget(self.btnVenvPath, 9, 2)

        self.connect(self.btnBrowse, SIGNAL("clicked()"), self.select_file)
        self.connect(self.btnPythonPath, SIGNAL("clicked()"),
                     self._load_python_path)
        self.connect(self.btnVenvPath, SIGNAL("clicked()"),
                     self._load_python_venv)
        self.connect(self.btnPreExec, SIGNAL("clicked()"),
                     self.select_pre_exec_script)
        self.connect(self.btnPostExec, SIGNAL("clicked()"),
                     self.select_post_exec_script)
 def test_icon_png(self):
     """Test we can click OK."""
     path = ':/plugins/KortForsyningen/icon.png'
     icon = QIcon(path)
     self.assertFalse(icon.isNull())
Exemplo n.º 52
0
    def add_action(
        self,
        icon_path,
        text,
        callback,
        enabled_flag=True,
        add_to_menu=True,
        add_to_toolbar=True,
        status_tip=None,
        whats_this=None,
        parent=None):
        """Agrega una acción la la barra de herramientas, y al menú del plugin.

        :param icon_path: Ruta del icono. Puede ser la ruta de un recurso recurso
            (ejemplo: ':/plugins/foo/bar.png') o una ruta normal del sistema de archivos
        :type icon_path: str

        :param text: Texto que será mostrado en el menu de opciones de plugin para esta accion.
        :type text: str

        :param callback: Función que será llamada cuando se hace click sobre la acción.
        :type callback: function

        :param enabled_flag: Una bandera que indica si la acción debería ser activada
            por defecto. Por defecto este valor esta en True.
        :type enabled_flag: bool

        :param add_to_menu: Una bandera indicando si la acción debería ser agregada
            al menú de opciones del plugin. Por defecto esta en True
        :type add_to_menu: bool

        :param add_to_toolbar: Una bandera indicando si la acción debería ser agregada
            a la barra de herramientas del plugin. Por defecto esta en True
        :type add_to_toolbar: bool

        :param status_tip: Texto opcional que aparecerá cuando el puntero del mouse
            se pocisione sobre la acción.
        :type status_tip: str

        :param parent: Widget padre de la nueva acción. Por defecto será None
        :type parent: QWidget

        :param whats_this: Texto opcional para mostrar en la barra de estatus,
            cuando el puntero del mouse se pocisione sobre la acción.

        :returns: La acción que fue creada. Notar que la acción también es
            agregada a self.actions list.
        :rtype: QAction
        """

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if add_to_menu:
            self.iface.addPluginToMenu(
                self.menu,
                action)

        self.actions.append(action)

        return action
Exemplo n.º 53
0
    def init_UI(self):
        """Create all of the widget objects required"""
        self.centre_widget = QWidget()
        self.tabs = QTabWidget()  # make tabs for each main display
        self.centre_widget.layout = QVBoxLayout()
        self.centre_widget.layout.addWidget(self.tabs)
        self.centre_widget.setLayout(self.centre_widget.layout)
        self.setCentralWidget(self.centre_widget)

        num_e = len(self.tr.seq_dic['Event list array in'])
        num_s = len(self.tr.seq_dic['Experimental sequence cluster in']
                    ['Sequence header top'])
        menubar = self.menuBar()

        # save/load a sequence file
        menubar.clear(
        )  # prevents recreating menubar if init_UI() is called again
        seq_menu = menubar.addMenu('Sequence')
        load = QAction('Load Sequence', self)
        load.triggered.connect(self.load_seq_from_file)
        seq_menu.addAction(load)
        save = QAction('Save Sequence', self)
        save.triggered.connect(self.save_seq_file)
        seq_menu.addAction(save)

        #### tab for previewing sequences ####
        preview_tab = QWidget()
        prv_layout = QVBoxLayout()
        preview_tab.setLayout(prv_layout)
        scroll_widget = QWidget()
        prv_layout.addWidget(scroll_widget)
        prv_vbox = QVBoxLayout()
        scroll_widget.setLayout(prv_vbox)
        self.tabs.addTab(preview_tab, "Sequence")

        # position the widgets on the layout:
        # metadata
        self.routine_name = QLabel('', self)
        self.routine_desc = QLabel('', self)
        for label, name in [[self.routine_name, 'Routine name: '],
                            [self.routine_desc, 'Routine description: ']]:
            layout = QHBoxLayout()
            title = QLabel(name, self)
            title.setFixedWidth(200)
            layout.addWidget(title)
            label.setStyleSheet('border: 1px solid black')
            label.setFixedWidth(400)
            layout.addWidget(label)
            prv_vbox.addLayout(layout)

        # list of event descriptions
        self.e_list = QTableWidget(4, num_e)
        self.e_list.setVerticalHeaderLabels([
            'Event name: ', 'Routine specific event? ', 'Event indices: ',
            'Event path: '
        ])
        self.e_list.setFixedHeight(150)
        self.reset_table(self.e_list, 0)
        prv_vbox.addWidget(self.e_list)

        # event header top
        self.head_top = QTableWidget(14, num_s)
        self.head_top.setVerticalHeaderLabels([
            'Skip Step: ', 'Event name: ', 'Hide event steps: ', 'Event ID: ',
            'Time step name: ', 'Populate multirun: ', 'Time step length: ',
            'Time unit: ', 'D/A trigger: ', 'Trigger this time step? ',
            'Channel: ', 'Analogue voltage (V): ', 'GPIB event name: ',
            'GPIB on/off? '
        ])
        self.head_top.setFixedHeight(450)
        self.reset_table(self.head_top, 0)
        prv_vbox.addWidget(self.head_top)

        # fast digital channels
        fd_head = QLabel('Fast Digital', self)
        prv_vbox.addWidget(fd_head)

        self.fd_chans = QTableWidget(self.tr.nfd, num_s)
        self.fd_chans.setFixedHeight(400)
        self.reset_table(self.fd_chans, 1)
        prv_vbox.addWidget(self.fd_chans)

        # fast analogue channels
        fa_head = QLabel('Fast Analogue', self)
        prv_vbox.addWidget(fa_head)
        self.fa_chans = QTableWidget(self.tr.nfa, num_s * 2)
        self.fa_chans.setFixedHeight(260)
        self.reset_table(self.fa_chans, 0)
        prv_vbox.addWidget(self.fa_chans)

        # event header middle
        self.head_mid = QTableWidget(14, num_s)
        self.head_mid.setVerticalHeaderLabels([
            'Skip Step: ', 'Event name: ', 'Hide event steps: ', 'Event ID: ',
            'Time step name: ', 'Populate multirun: ', 'Time step length: ',
            'Time unit: ', 'D/A trigger: ', 'Trigger this time step? ',
            'Channel: ', 'Analogue voltage (V): ', 'GPIB event name: ',
            'GPIB on/off? '
        ])
        self.head_mid.setFixedHeight(450)
        self.reset_table(self.head_mid, 0)
        prv_vbox.addWidget(self.head_mid)

        # slow digital channels
        sd_head = QLabel('Slow Digital', self)
        prv_vbox.addWidget(sd_head)

        self.sd_chans = QTableWidget(self.tr.nsd, num_s)
        self.sd_chans.setFixedHeight(400)
        self.reset_table(self.sd_chans, 1)
        prv_vbox.addWidget(self.sd_chans)

        # slow analogue channels
        sa_head = QLabel('Slow Analogue', self)
        prv_vbox.addWidget(sa_head)

        self.sa_chans = QTableWidget(self.tr.nsa, num_s * 2)
        self.sa_chans.setFixedHeight(400)
        self.reset_table(self.sa_chans, 0)
        prv_vbox.addWidget(self.sa_chans)

        # place scroll bars if the contents of the window are too large
        scroll = QScrollArea(self)
        scroll.setWidget(scroll_widget)
        scroll.setWidgetResizable(True)
        scroll.setFixedHeight(800)
        prv_layout.addWidget(scroll)

        #### tab for multi-run settings ####
        self.mr = multirun_widget(self.tr)
        self.tabs.addTab(self.mr, "Multirun")

        mr_menu = menubar.addMenu('Multirun')
        mrload = QAction('Load Parameters', self)
        mrload.triggered.connect(self.mr.load_mr_params)
        mr_menu.addAction(mrload)
        mrsave = QAction('Save Parameters', self)
        mrsave.triggered.connect(self.mr.save_mr_params)
        mr_menu.addAction(mrsave)
        mrqueue = QAction('View Queue', self)
        mrqueue.triggered.connect(self.mr.view_mr_queue)
        mr_menu.addAction(mrqueue)

        # choose main window position and dimensions: (xpos,ypos,width,height)
        self.setWindowTitle('Multirun Editor and Sequence Preview')
        self.setWindowIcon(QIcon('docs/previewicon.png'))
 def getIcon(self):
     return QIcon(os.path.dirname(__file__) + '/icons/pt.png')
Exemplo n.º 55
0
    def __init__(self, column, parent=None, pixmap=None, host=None):
        """
        Class constructor.
        :param column: Column object containing foreign key information.
        :type column: BaseColumn
        :param parent: Parent widget for the control.
        :type parent: QWidget
        :param pixmap: Pixmap to use for the line edit button.
        :type pixmap: QPixmap
        """

        QLineEdit.__init__(self, parent)

        self.column = column
        self._entity = self.column.entity
        self.entity_dialog = host

        #Configure load button
        self.btn_load = QToolButton(parent)
        self.btn_load.setCursor(Qt.PointingHandCursor)
        self.btn_load.setFocusPolicy(Qt.NoFocus)
        px = QPixmap(':/plugins/stdm/images/icons/select_record.png')
        if not pixmap is None:
            px = pixmap
        self.btn_load.setIcon(QIcon(px))
        self.btn_load.setIconSize(px.size())
        self.btn_load.setStyleSheet('background: transparent; padding: 0px; '
                                    'border: none;')
        self.btn_load.clicked.connect(self.on_load_foreign_key_browser)

        clear_px = QPixmap(':/plugins/stdm/images/icons/clear.png')

        self.btn_clear = QToolButton(parent)
        self.btn_clear.setCursor(Qt.PointingHandCursor)
        self.btn_clear.setFocusPolicy(Qt.NoFocus)
        self.btn_clear.setIcon(QIcon(clear_px))
        self.btn_clear.setIconSize(clear_px.size())
        self.btn_clear.setStyleSheet('background: transparent; padding: 0px; '
                                    'border: none;')

        self.btn_clear.clicked.connect(self.clear_line_edit)


        frame_width = self.set_button_minimum_size(self.btn_load)
        self.set_button_minimum_size(self.btn_clear)
        # Ensure that text does not overlay button
        padding = self.btn_load.sizeHint().width() + frame_width + 1

        self.setStyleSheet('padding-right: ' + str(padding * 2) + 'px;')

        # Set layout
        self.button_layout = QHBoxLayout(self)

        self.button_layout.addWidget(self.btn_clear, 0, Qt.AlignRight)
        self.button_layout.addWidget(self.btn_load, 0, Qt.AlignRight)

        self.button_layout.setSpacing(0)
        self.button_layout.setMargin(5)

        self.btn_clear.setVisible(False)
        # Readonly as text is loaded from the related entity
        self.setReadOnly(True)

        # Current model object
        self._current_item = None
Exemplo n.º 56
0
    def __init__(self, parent=None):
        super(OverviewScene, self).__init__(parent)
        self.colorTable = None
        self.anaglyph = False
        self.sceneItems = []
        self.cutter = 3*[None]
        self.objects = []
        self.planes = None
        self.axes = None
        self._dataShape = None
        
        layout = QVBoxLayout()
        layout.setMargin(0)
        layout.setSpacing(0)
        self.qvtk = QVTKOpenGLWidget()
        layout.addWidget(self.qvtk)
        self.setLayout(layout)
        self.qvtk.init()
        hbox = QHBoxLayout(None)
        hbox.setMargin(0)
        hbox.setSpacing(5)
        hbox.setContentsMargins(5,3,5,3)
        
        def delete_gl_widget():
            # This is called just before the app quits to avoid this error during shutdown:
            # QGLContext::makeCurrent: Cannot make invalid context current
            self.qvtk.setParent(None)
            del self.qvtk
        QApplication.instance().aboutToQuit.connect( delete_gl_widget )
        
        b1 = QToolButton()
        b1.setIcon(QIcon(':icons/icons/x-axis.png'))
        b1.setToolTip("Show x slicing plane")
        b1.setCheckable(True); b1.setChecked(True)
        
        b2 = QToolButton()
        b2.setIcon(QIcon(':icons/icons/y-axis.png'))
        b2.setToolTip("Show y slicing plane")
        b2.setCheckable(True); b2.setChecked(True)
        
        b3 = QToolButton()
        b3.setIcon(QIcon(':icons/icons/z-axis.png'))
        b3.setToolTip("Show z slicing plane")
        b3.setCheckable(True); b3.setChecked(True)
        
        bAnaglyph = QToolButton()
        bAnaglyph.setIcon(QIcon(':icons/icons/3d_glasses.png'))
        bAnaglyph.setToolTip("Show in anaglyph 3D")
        bAnaglyph.setCheckable(True); bAnaglyph.setChecked(False)
       
        '''
        bCutter = QToolButton()
        bCutter.setIcon(QIcon(':icons/icons/edit-cut.png'))
        bCutter.setCheckable(True); bCutter.setChecked(False)
        self.bCutter = bCutter
        
        bExportMesh = QToolButton()
        bExportMesh.setIcon(QIcon(':icons/icons/document-save-as.png'))
        '''
        
        hbox.addWidget(b1)
        hbox.addWidget(b2)
        hbox.addWidget(b3)
        hbox.addWidget(bAnaglyph)
        #hbox.addWidget(bCutter)
        hbox.addStretch()
        #hbox.addWidget(bExportMesh)
        layout.addLayout(hbox)
        
        self.connect(b1, SIGNAL("clicked()"), self.TogglePlaneWidgetX)
        self.connect(b2, SIGNAL("clicked()"), self.TogglePlaneWidgetY)
        self.connect(b3, SIGNAL("clicked()"), self.TogglePlaneWidgetZ)
        self.connect(bAnaglyph, SIGNAL("clicked()"), self.ToggleAnaglyph3D)
        #self.connect(bExportMesh, SIGNAL("clicked()"), self.exportMesh)
        #bCutter.toggled.connect(self.useCutterToggled)
        self.connect(self.qvtk, SIGNAL("objectPicked"), self.__onObjectPicked)
        
        def layerContextMenu(layer, menu):
          self.layerContextMenu(layer,menu)

        Event.register("layerContextMenuRequested", layerContextMenu)
Exemplo n.º 57
0
 def getIcon(self):
     return QIcon(dirname(__file__) + '/../../icon.png')
Exemplo n.º 58
0
 def getIcon(self):
     return QIcon(":/plugins/dzetsaka/img/icon.png")
Exemplo n.º 59
0
 def _setEolMode(self, mode):
     """Change EOL mode on GUI
     """
     if mode is not None:
         self.setIcon(QIcon(':/enkiicons/' + self._ICON_FOR_MODE[mode]))
Exemplo n.º 60
0
 def icon(self):
     if icon is not None:
         return get_icon(icon)
     else:
         return QIcon()