Python PyQt4.QtGui.QPixmap() Examples

The following are 30 code examples of PyQt4.QtGui.QPixmap(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt4.QtGui , or try the search function .
Example #1
Source File: universal_tool_template_0903.py    From universal_tool_template.py with MIT License 7 votes vote down vote up
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version="0.1"
        self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__
            
        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name) 
Example #2
Source File: window_ui.py    From memo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
def setupUi(self, Window):
        '''被主窗口调用'''
        Window.setWindowTitle(_fromUtf8("便签"))
        Window.setMinimumWidth(400)
        Window.setMaximumWidth(400)

        '''初始化组件'''
        self.layout = QtGui.QVBoxLayout()
        self.topLabelPix = QtGui.QPixmap(setting.topLabelImgPath)
        self.topLabel = QtGui.QLabel()

        '''设置组件属性'''
        self.layout.setMargin(0)
        self.layout.setSpacing(0)
        self.topLabel.setPixmap(self.topLabelPix)

        '''设置布局'''
        self.layout.addWidget(self.topLabel)

        self.setLayout(self.layout) 
Example #3
Source File: FlatCAMGUI.py    From FlatCAM with MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(FlatCAMInfoBar, self).__init__(parent=parent)

        self.icon = QtGui.QLabel(self)
        self.icon.setGeometry(0, 0, 12, 12)
        self.pmap = QtGui.QPixmap('share/graylight12.png')
        self.icon.setPixmap(self.pmap)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(5, 0, 5, 0)
        self.setLayout(layout)

        layout.addWidget(self.icon)

        self.text = QtGui.QLabel(self)
        self.text.setText("Hello!")
        self.text.setToolTip("Hello!")

        layout.addWidget(self.text)

        layout.addStretch() 
Example #4
Source File: fader.py    From tutorials with MIT License 6 votes vote down vote up
def __init__(self, old_widget, new_widget=None, duration=1000, reverse=False):
    
        QtGui.QWidget.__init__(self, new_widget)
        
        self.resize(old_widget.size())
        
        self.old_pixmap = QtGui.QPixmap(old_widget.size())
        old_widget.render(self.old_pixmap)
        
        self.pixmap_opacity = 1.0
        
        self.timeline = QtCore.QTimeLine()
        if reverse:
            self.timeline.setDirection(self.timeline.Backward)
        self.timeline.valueChanged.connect(self.animate)
        self.timeline.finished.connect(self.deleteLater)
        self.timeline.setDuration(duration)

        self.timeline.start()
        self.show() 
Example #5
Source File: PlotWindow.py    From qkit with GNU General Public License v2.0 6 votes vote down vote up
def registerCmap(self):
        """ Add matplotlib cmaps to the GradientEditors context menu"""
        self.gradientEditorItem.menu.addSeparator()
        savedLength = self.gradientEditorItem.length
        self.gradientEditorItem.length = 100
        
        
        for name in self.mplColorMaps:
            px = QPixmap(100, 15)
            p = QPainter(px)
            self.gradientEditorItem.restoreState(self.mplColorMaps[name])
            grad = self.gradientEditorItem.getGradient()
            brush = QBrush(grad)
            p.fillRect(QtCore.QRect(0, 0, 100, 15), brush)
            p.end()
            label = QLabel()
            label.setPixmap(px)
            label.setContentsMargins(1, 1, 1, 1)
            act =QWidgetAction(self.gradientEditorItem)
            act.setDefaultWidget(label)
            act.triggered.connect(self.cmapClicked)
            act.name = name
            self.gradientEditorItem.menu.addAction(act)
        self.gradientEditorItem.length = savedLength 
Example #6
Source File: run.py    From PyLinuxQQ with GNU General Public License v2.0 6 votes vote down vote up
def showCode(self):
        pixmap = QtGui.QPixmap()
        pixmap.load("api/code.jpg")
        pixmap.scaledToHeight(60)
        pixmap.scaledToWidth(120)
        self.scene_code = QtGui.QGraphicsScene(self)
        item = QtGui.QGraphicsPixmapItem(pixmap)
        self.scene_code.addItem(item)
        self.ui.img_code.setScene(self.scene_code)
        self.resize(257, 235)
        self.ui.lbl_code.setGeometry(QtCore.QRect(20, 110, 63, 18))
        self.ui.text_code.setGeometry(QtCore.QRect(70, 100, 113, 28))
        self.ui.img_code.setGeometry(QtCore.QRect(60, 130, 120, 50))
        self.ui.btn_login.setGeometry(QtCore.QRect(20, 190, 93, 27))
        self.ui.btn_cancel.setGeometry(QtCore.QRect(140, 190, 93, 27))
        self.ui.lbl_code.show()
        self.ui.text_code.show()
        self.ui.img_code.show()

# chat 
Example #7
Source File: program.py    From nupic.studio with GNU General Public License v2.0 6 votes vote down vote up
def main():
  Global.app = QtGui.QApplication(sys.argv)
  Global.app.setStyleSheet("QGroupBox { border: 1px solid gray; } QGroupBox::title { padding: 0 5px; }")

  Global.appPath = os.path.abspath(os.path.join(__file__, '..'))
  Global.loadConfig()

  Global.project = Project()
  Global.simulationForm = SimulationForm()
  Global.architectureForm = ArchitectureForm()
  Global.nodeInformationForm = NodeInformationForm()
  Global.outputForm = OutputForm()
  Global.mainForm = MainForm()

  # Create and display the splash screen
  start = time.time()
  splash_pix = QtGui.QPixmap(Global.appPath + '/images/splash.png')
  splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
  splash.setMask(splash_pix.mask())
  splash.show()
  while time.time() - start < 3:
    time.sleep(0.001)
    Global.app.processEvents()
  splash.close()

  # Show start form
  startForm = StartForm()
  startForm.show()

  deploymentBuild = os.getenv("NUPIC_STUDIO_DEPLOYMENT_BUILD", False)
  if deploymentBuild:
    sys.exit(0)
  else:
    sys.exit(Global.app.exec_()) 
Example #8
Source File: ui_about_dialog.py    From qgpkg with MIT License 6 votes vote down vote up
def setupUi(self, qgpkgDlg):
        qgpkgDlg.setObjectName(_fromUtf8("qgpkgDlg"))
        qgpkgDlg.resize(456, 358)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/QgisGeopackage/about.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        qgpkgDlg.setWindowIcon(icon)
        self.verticalLayout = QtGui.QVBoxLayout(qgpkgDlg)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.textEdit = QtGui.QTextEdit(qgpkgDlg)
        self.textEdit.setReadOnly(True)
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.verticalLayout.addWidget(self.textEdit)
        self.button_box = QtGui.QDialogButtonBox(qgpkgDlg)
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Close)
        self.button_box.setObjectName(_fromUtf8("button_box"))
        self.verticalLayout.addWidget(self.button_box)

        self.retranslateUi(qgpkgDlg)
        QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("accepted()")), qgpkgDlg.accept)
        QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("rejected()")), qgpkgDlg.reject)
        QtCore.QMetaObject.connectSlotsByName(qgpkgDlg) 
Example #9
Source File: appgui.py    From mishkal with GNU General Public License v3.0 6 votes vote down vote up
def about(self):
        RightToLeft=1;
        msgBox=QtGui.QMessageBox(self.centralwidget);
        msgBox.setWindowTitle(u"عن البرنامج");
##          msgBox.setTextFormat(QrCore.QRichText);

        data=QtCore.QFile("ar/about.html");
        if (data.open(QtCore.QFile.ReadOnly)):
            textstream=QtCore.QTextStream(data);
            textstream.setCodec("UTF-8");
            text_about=textstream.readAll();
        else:
#            text=u"لا يمكن فتح ملف المساعدة"
            text_about=u"""<h1>فكرة</h1>

"""
        msgBox.setText(text_about);
        msgBox.setLayoutDirection(RightToLeft);
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok);
        msgBox.setIconPixmap(QtGui.QPixmap(os.path.join(PWD, "ar/images/logo.png")));
        msgBox.setDefaultButton(QtGui.QMessageBox.Ok);
        msgBox.exec_(); 
Example #10
Source File: pressure.py    From wacom-gui with GNU General Public License v3.0 5 votes vote down vote up
def tabletEvent(self, event):
        senId = ""
        if self.sensor == "stylus" :
            senId = QtGui.QTabletEvent.Pen
        elif self.sensor == "eraser":
            senId = QtGui.QTabletEvent.Eraser
        elif self.sensor == "cursor":
            senId = QtGui.QTabletEvent.Cursor
        if event.pointerType() == senId:
            curpressure = event.pressure()
            if curpressure < 0:
                curpressure += 1
            amp = int(curpressure * 50)
            color = (1 - amp/50.0) * 255
            pen = QtGui.QPen(QtGui.QColor(color,color,color,0))

            radial = QtGui.QRadialGradient(QtCore.QPointF(event.x(),event.y()),amp,QtCore.QPointF(event.xTilt() * amp/50 ,event.yTilt() * amp))
            radial.setColorAt(0,QtGui.QColor(color,color,color,255))
            radial.setColorAt(1,QtGui.QColor(color,color,color,0))
            brush = QtGui.QBrush(radial)
            if(amp >= 1):
                if len(self.scene.items()) >= 50:
                    render = QtGui.QPixmap(250,250)
                    painter = QtGui.QPainter(render)
                    rect = QtCore.QRectF(0,0,250,250)
                    self.scene.render(painter,rect,rect,QtCore.Qt.KeepAspectRatio)
                    self.scene.clear()
                    self.scene.addPixmap(render)
                    painter.end()
                self.scene.addEllipse(event.x() - amp, event.y() -amp, amp, amp, pen, brush)
            self.info.updateInfo(event.xTilt(),event.yTilt(),amp) 
Example #11
Source File: universal_tool_template_0803.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version="0.1"
        self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__
            
        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)
        
        # Custom user variable
        #------------------------------
        # initial data
        #------------------------------
        self.memoData['data']=[]
        
        self.setupStyle()
        if isinstance(self, QtWidgets.QMainWindow):
            self.setupMenu()
        self.setupWin()
        self.setupUI()
        self.Establish_Connections()
        self.loadData()
        self.loadLang() 
Example #12
Source File: universal_tool_template_0904.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version="0.1"
        self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
            
        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)
        
        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        self.qui_user_dict = {}
        #------------------------------ 
Example #13
Source File: LicUndoActions.py    From lic with GNU General Public License v3.0 5 votes vote down vote up
def doAction(self, redo):
        filename = self.newFilename if redo else self.oldFilename
        self.annotation.setPixmap(QPixmap(filename))
        self.annotation.adjustToPageSize() 
Example #14
Source File: ui_composer_symbol_editor.py    From stdm with GNU General Public License v2.0 5 votes vote down vote up
def setupUi(self, frmComposerSymbolEditor):
        frmComposerSymbolEditor.setObjectName(_fromUtf8("frmComposerSymbolEditor"))
        frmComposerSymbolEditor.resize(340, 320)
        self.gridLayout = QtGui.QGridLayout(frmComposerSymbolEditor)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label = QtGui.QLabel(frmComposerSymbolEditor)
        self.label.setMaximumSize(QtCore.QSize(100, 16777215))
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.cboSpatialFields = QtGui.QComboBox(frmComposerSymbolEditor)
        self.cboSpatialFields.setMinimumSize(QtCore.QSize(0, 30))
        self.cboSpatialFields.setObjectName(_fromUtf8("cboSpatialFields"))
        self.gridLayout.addWidget(self.cboSpatialFields, 0, 1, 1, 1)
        self.btnAddField = QtGui.QPushButton(frmComposerSymbolEditor)
        self.btnAddField.setMaximumSize(QtCore.QSize(30, 30))
        self.btnAddField.setText(_fromUtf8(""))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/add.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnAddField.setIcon(icon)
        self.btnAddField.setObjectName(_fromUtf8("btnAddField"))
        self.gridLayout.addWidget(self.btnAddField, 0, 2, 1, 1)
        self.btnClear = QtGui.QPushButton(frmComposerSymbolEditor)
        self.btnClear.setMaximumSize(QtCore.QSize(30, 30))
        self.btnClear.setText(_fromUtf8(""))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/reset.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnClear.setIcon(icon1)
        self.btnClear.setObjectName(_fromUtf8("btnClear"))
        self.gridLayout.addWidget(self.btnClear, 0, 3, 1, 1)
        self.tbFieldProperties = QtGui.QTabWidget(frmComposerSymbolEditor)
        self.tbFieldProperties.setTabsClosable(True)
        self.tbFieldProperties.setObjectName(_fromUtf8("tbFieldProperties"))
        self.gridLayout.addWidget(self.tbFieldProperties, 1, 0, 1, 4)

        self.retranslateUi(frmComposerSymbolEditor)
        self.tbFieldProperties.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(frmComposerSymbolEditor) 
Example #15
Source File: ui_source_document_dialog.py    From stdm with GNU General Public License v2.0 5 votes vote down vote up
def setupUi(self, SourceDocumentTranslatorDialog):
        SourceDocumentTranslatorDialog.setObjectName(_fromUtf8("SourceDocumentTranslatorDialog"))
        SourceDocumentTranslatorDialog.resize(497, 127)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(SourceDocumentTranslatorDialog.sizePolicy().hasHeightForWidth())
        SourceDocumentTranslatorDialog.setSizePolicy(sizePolicy)
        SourceDocumentTranslatorDialog.setMinimumSize(QtCore.QSize(0, 127))
        self.gridLayout = QtGui.QGridLayout(SourceDocumentTranslatorDialog)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.vlNotification = QtGui.QVBoxLayout()
        self.vlNotification.setObjectName(_fromUtf8("vlNotification"))
        self.gridLayout.addLayout(self.vlNotification, 0, 0, 1, 3)
        self.label = QtGui.QLabel(SourceDocumentTranslatorDialog)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
        self.txtRootFolder = QtGui.QLineEdit(SourceDocumentTranslatorDialog)
        self.txtRootFolder.setMinimumSize(QtCore.QSize(0, 30))
        self.txtRootFolder.setObjectName(_fromUtf8("txtRootFolder"))
        self.gridLayout.addWidget(self.txtRootFolder, 1, 1, 1, 1)
        self.btn_source_doc_folder = QtGui.QToolButton(SourceDocumentTranslatorDialog)
        self.btn_source_doc_folder.setMinimumSize(QtCore.QSize(30, 30))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/stdm/images/icons/open_file.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btn_source_doc_folder.setIcon(icon)
        self.btn_source_doc_folder.setObjectName(_fromUtf8("btn_source_doc_folder"))
        self.gridLayout.addWidget(self.btn_source_doc_folder, 1, 2, 1, 1)
        self.buttonBox = QtGui.QDialogButtonBox(SourceDocumentTranslatorDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 3)

        self.retranslateUi(SourceDocumentTranslatorDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), SourceDocumentTranslatorDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), SourceDocumentTranslatorDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(SourceDocumentTranslatorDialog) 
Example #16
Source File: image_show.py    From BossSensor with MIT License 5 votes vote down vote up
def show_image(image_path='s_pycharm.jpg'):
    app = QtGui.QApplication(sys.argv)
    pixmap = QtGui.QPixmap(image_path)
    screen = QtGui.QLabel()
    screen.setPixmap(pixmap)
    screen.showFullScreen()
    sys.exit(app.exec_()) 
Example #17
Source File: Application.py    From eSim with GNU General Public License v3.0 5 votes vote down vote up
def main(args):
    """
    The splash screen opened at the starting of screen is performed
    by this function.
    """
    print("Starting eSim......")
    app = QtGui.QApplication(args)

    splash_pix = QtGui.QPixmap('images/splash_screen_esim.png')
    splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    appView = Application()
    appView.splash = splash
    appView.obj_workspace.returnWhetherClickedOrNot(appView)

    try:
        file = open(os.path.join(
            os.path.expanduser("~"), ".esim/workspace.txt"), 'r'
        )
        work = int(file.read(1))
        file.close()
    except IOError:
        work = 0
    if work != 0:
        appView.obj_workspace.defaultWorkspace()
    else:
        appView.hide()
        appView.obj_workspace.show()

    sys.exit(app.exec_())


# Call main function 
Example #18
Source File: gui_qt.py    From ComicStreamer with Apache License 2.0 5 votes vote down vote up
def __init__(self, apiServer):
        self.apiServer =  apiServer
        
        self.app = QtGui.QApplication(sys.argv)
        
        pixmap = QtGui.QPixmap(AppFolders.imagePath("trout.png"))
        icon = QtGui.QIcon( pixmap.scaled(16,16))       

        self.trayIcon = SystemTrayIcon(icon,self)
    
        self.trayIcon.show() 
Example #19
Source File: qt-example.py    From SimpleCV2 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def show_frame(self):
        ipl_image = self.webcam.getImage()
        ipl_image.dl().circle((150, 75), 50, Color.RED, filled = True)
        data = ipl_image.getBitmap().tostring()
        image = QtGui.QImage(data, ipl_image.width, ipl_image.height, 3 * ipl_image.width, QtGui.QImage.Format_RGB888)
        pixmap = QtGui.QPixmap()
        pixmap.convertFromImage(image.rgbSwapped())
        self.MainWindow.label.setPixmap(pixmap) 
Example #20
Source File: pressure.py    From wacom-gui with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, tabletName, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setFixedSize(250, 300)
        self.scene = QtGui.QGraphicsScene()
        self.scene.setBspTreeDepth(1)
        self.view = QtGui.QGraphicsView(self.scene)
        self.view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.tabletName = tabletName
        self.info = pressureInfo(self.tabletName)

        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter.addWidget(self.view)
        splitter.addWidget(self.info)
        splitter.setSizes([200, 50])
        splitter.handle(0).setEnabled(False)
        splitter.handle(1).setEnabled(False)
        #print splitter.count()

        testLayout = QtGui.QVBoxLayout()
        testLayout.setAlignment(QtCore.Qt.AlignBottom)
        testLayout.addWidget(splitter)
        self.setLayout(testLayout)
        self.blank = QtGui.QPixmap(250,250)
        self.blank.fill(QtCore.Qt.white)
        self.pixmap_item = QtGui.QGraphicsPixmapItem(self.blank, None, self.scene) 
Example #21
Source File: guiMainQQ.py    From PyLinuxQQ with GNU General Public License v2.0 5 votes vote down vote up
def setupSelf(self,main,account,lnick):
        pixmap = QtGui.QPixmap()
        pixmap.load('tmp/head/' + str(account) + '.jpg')
        scene = QtGui.QGraphicsScene(main)
        item = QtGui.QGraphicsPixmapItem(pixmap)
        scene.addItem(item)
        self.img_head.setScene(scene)
        self.lbl_head.setText(_translate("Main", str(account), None))
        self.lbl_content.setText(_translate("Main", lnick, None)) 
Example #22
Source File: guiMainQQ.py    From PyLinuxQQ with GNU General Public License v2.0 5 votes vote down vote up
def setupFace(self, main,data):
        
        for i in range(len(data['friends'])):
            name = str(data['friends'][i]['uin'])
            pixmap = QtGui.QPixmap()
            if not os.path.exists('tmp/head/'+name+'.jpg'):
                name = 'qq'
            pixmap.load('tmp/head/' + name + '.jpg')
            scene = QtGui.QGraphicsScene(main)
            item = QtGui.QGraphicsPixmapItem(pixmap)
            scene.addItem(item)
            self.graphicsView[data['friends'][i]['uin']].setScene(scene)
            self.graphicsView[data['friends'][i]['uin']].resize(50,50) 
Example #23
Source File: wizard_maker.py    From easygui_qt with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def create_page(self, page):
        new_page = qt_widgets.QWizardPage()
        layout = qt_widgets.QVBoxLayout()
        for kind, value in page:
            if kind.lower() == "title":
                new_page.setTitle(value)
            elif kind.lower() == "text":
                label = qt_widgets.QLabel(value)
                label.setWordWrap(True)
                layout.addWidget(label)
            elif kind.lower() == "image":
                label =  qt_widgets.QLabel()
                pixmap =  QtGui.QPixmap(value)
                label.setPixmap(pixmap)
                layout.addWidget(label)
            elif kind.lower() == "many images":
                h_layout = qt_widgets.QHBoxLayout()
                h_box = qt_widgets.QGroupBox('')
                for image in value:
                    label =  qt_widgets.QLabel()
                    pixmap =  QtGui.QPixmap(image)
                    label.setPixmap(pixmap)
                    h_layout.addWidget(label)
                h_box.setLayout(h_layout)
                layout.addWidget(h_box)
        new_page.setLayout(layout)
        self.addPage(new_page) 
Example #24
Source File: guiMainQQ.py    From PyLinuxQQ with GNU General Public License v2.0 5 votes vote down vote up
def createImg(self,flag,uin):
        pixmap = QtGui.QPixmap()
        if flag=='discuss':
            url='tmp/sys/discuss.png'
        elif flag=='group':
            url='tmp/sys/group.jpg'
        else:
            url='tmp/head/'+str(uin)+'.jpg'
            if not os.path.exists(url):
                url='tmp/head/qq.jpg'
        pixmap.load(url)
        scene = QtGui.QGraphicsScene()
        item = QtGui.QGraphicsPixmapItem(pixmap)
        scene.addItem(item)
        return scene 
Example #25
Source File: guiChatQQ.py    From PyLinuxQQ with GNU General Public License v2.0 5 votes vote down vote up
def createImg(self,uin,flag=0,g_sender=None):
        ex='head'
        if flag==0:
            name = str(uin)+'.jpg'
        else:
            if flag==1 and g_sender is None:
                ex='sys'
                name='group.jpg'
            elif flag==2 and g_sender is None:
                ex='sys'
                name='discuss.png'
            else:
                name = str(g_sender)+'.jpg'
        pixmap = QtGui.QPixmap()

        if not os.path.exists('tmp/'+ex+'/' + name ):
            if flag!=0:
                self.main.loadFace(g_sender)
                print 'load group face'
            name = 'qq.jpg'
        print 'pic:','tmp/',ex,'/',name
        pixmap.load('tmp/'+ex+'/' + name )
        scene = QtGui.QGraphicsScene()
        item = QtGui.QGraphicsPixmapItem(pixmap)
        scene.addItem(item)
        return scene 
Example #26
Source File: file_upload.py    From EasyStorj with MIT License 5 votes vote down vote up
def resizeEvent(self, event):
        current_window_width = self.frameGeometry().width()
        if current_window_width < 980 and self.is_files_queue_table_visible:
            #self.is_files_queue_table_visible = False
            #self.ui_single_file_upload.files_list_view_bt.setPixmap(QtGui.QPixmap(":/resources/rarrow.png"))
            print "Closed"
        elif current_window_width > 980 and not self.is_files_queue_table_visible:
            #self.is_files_queue_table_visible = True
            #self.ui_single_file_upload.files_list_view_bt.setPixmap(QtGui.QPixmap(":/resources/larrow.jpg"))
            print "Opened" 
Example #27
Source File: file_upload.py    From EasyStorj with MIT License 5 votes vote down vote up
def display_files_queue_change(self, x):
        self.animation = QtCore.QPropertyAnimation(self, "size")
        # self.animation.setDuration(1000) #Default 250ms

        if self.is_files_queue_table_visible:
            self.animation.setEndValue(QtCore.QSize(980, 611))
            self.is_files_queue_table_visible = False
            self.ui_single_file_upload.files_list_view_bt.setPixmap(QtGui.QPixmap(":/resources/rarrow.png"))
        else:
            self.animation.setEndValue(QtCore.QSize(1371, 611))
            self.is_files_queue_table_visible = True
            self.ui_single_file_upload.files_list_view_bt.setPixmap(QtGui.QPixmap(":/resources/larrow.jpg"))

        self.animation.start() 
Example #28
Source File: image_widget.py    From EasyStorj with MIT License 5 votes vote down vote up
def __init__(self, imagePath, parent):
        super(ImageWidget, self).__init__(parent)
        self.picture = QtGui.QPixmap(imagePath).scaled(
            30, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation) 
Example #29
Source File: mainUI.py    From EasyStorj with MIT License 5 votes vote down vote up
def change_loading_gif(self, is_visible):
        if is_visible:
            movie = QtGui.QMovie(':/resources/loading.gif')
            self.file_manager_ui.refresh_bt.setMovie(movie)
            movie.start()
        else:
            self.file_manager_ui.refresh_bt.setPixmap(QtGui.QPixmap((
                ':/resources/refresh.png'))) 
Example #30
Source File: ObjectCollection.py    From FlatCAM with MIT License 5 votes vote down vote up
def data(self, index, role=None):
        if not index.isValid():
            return QtCore.QVariant()

        if role in [Qt.Qt.DisplayRole, Qt.Qt.EditRole]:
            obj = index.internalPointer().obj
            if obj:
                return obj.options["name"]
            else:
                return index.internalPointer().data(index.column())

        if role == Qt.Qt.ForegroundRole:
            obj = index.internalPointer().obj
            if obj:
                return Qt.QBrush(QtCore.Qt.black) if obj.options["plot"] else Qt.QBrush(QtCore.Qt.darkGray)
            else:
                return index.internalPointer().data(index.column())

        elif role == Qt.Qt.DecorationRole:
            icon = index.internalPointer().icon
            if icon:
                return icon
            else:
                return Qt.QPixmap()
        else:
            return QtCore.QVariant()