当前位置: 首页>>代码示例>>Python>>正文


Python QByteArray.fromBase64方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QByteArray.fromBase64方法的典型用法代码示例。如果您正苦于以下问题:Python QByteArray.fromBase64方法的具体用法?Python QByteArray.fromBase64怎么用?Python QByteArray.fromBase64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore.QByteArray的用法示例。


在下文中一共展示了QByteArray.fromBase64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: restoreWindowState

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def restoreWindowState(self):
        # GUI settings
        history = util.readConfigString(GeneralConfig, "Url History", '')\
            .split(',')
        self.characterCombo.insertItems(history)
        self.historyLength = util.readConfigInt(GeneralConfig, "History Length",
            20)
        self.autoLookup = util.readConfigString(GeneralConfig,
            "Auto-Lookup clipboard", str(False)) != "False"
        self.autoLookupAction.setChecked(self.autoLookup)
        self.onlyAutoLookupCJKCharacters = util.readConfigString(GeneralConfig,
            "Auto-Lookup only Chinese characters", str(False)) != "False"

        self.splitterFrame.restoreState(QByteArray.fromBase64(
            str(util.readConfigString(GeneralConfig, "Splitter", ""))))
        self.splitterSizes = [int(i) for i \
            in util.readConfigString(GeneralConfig, "Splitter sizes",
                "220,426").split(',')]

        self.toolbarOriginalState = QByteArray.fromBase64(
            str(util.readConfigString(GeneralConfig, "Toolbar original state",
                "")))
        self.restoreState(self.toolbarOriginalState)
        self.menuBar().setVisible(True)

        self.characterChooser.setCurrentIndex(util.readConfigInt(GeneralConfig,
            "Toolbox current", 0))

        visible = GeneralConfig.readEntry("Toolbox visibile", str(True))
        if visible == "False":
            self.characterChooserOriginalVisibility = False
        else:
            self.splitterFrame.setSizes(self.splitterSizes)
            self.characterChooserOriginalVisibility = True
        self.characterChooser.setVisible(
            self.characterChooserOriginalVisibility)
        self.toggleToolboxAction.setChecked(
            self.characterChooserOriginalVisibility)

        w = util.readConfigInt(GeneralConfig, "Width", 640)
        h = util.readConfigInt(GeneralConfig, "Height", 420)
        self.defaultWindowSize = QSize(w, h)
        x = util.readConfigInt(GeneralConfig, "LastX", 0)
        y = util.readConfigInt(GeneralConfig, "LastY", 0)

        mini_w = util.readConfigInt(GeneralConfig, "Mini-mode Width", 400)
        mini_h = util.readConfigInt(GeneralConfig, "Mini-mode Height", 200)
        self.miniModeWindowSize = QSize(mini_w, mini_h)

        self.setGeometry(x, y, w, h)
开发者ID:cburgmer,项目名称:eclectus,代码行数:52,代码来源:main.py

示例2: __init__

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def __init__(self):
        QWidget.__init__(self)
        self.tray = Tray(self)
        self.setMinimumSize(QSize(320, 200))
        self.setWindowFlags(Qt.Popup|Qt.FramelessWindowHint)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setMargin(1)

        self.text = QTextBrowser(self)
        self.text.setReadOnly(True)
        self.text.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.text.setOpenExternalLinks(True)
        self.verticalLayout.addWidget(self.text)
        self.text.textChanged.connect(self.on_text_changed)
        self.notify = Notify(self)

        self.movie = QMovie()
        dev = QBuffer()
        dev.setData(QByteArray.fromBase64(CHECK_IMAGE))
        dev.open(QBuffer.ReadOnly)
        dev.setParent(self.movie)
        self.movie.setDevice(dev)
        self.movie.frameChanged.connect(self.on_frame_changed)

        self.realized = False
        self.show()
开发者ID:gen2brain,项目名称:gmailcheck,代码行数:28,代码来源:gmailcheck.py

示例3: get_icon

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
def get_icon(data):
    image = QImage()
    bytearr = QByteArray.fromBase64(data)
    image.loadFromData(bytearr, "PNG")
    pixmap = QPixmap.fromImage(image)
    icon = QIcon()
    icon.addPixmap(pixmap)
    return icon
开发者ID:gen2brain,项目名称:gmailcheck,代码行数:10,代码来源:gmailcheck.py

示例4: readPicture

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
	def readPicture(self, tree):
		"""
		Ließt das Charakterbild aus.
		"""

		pictureElement = tree.find("picture")
		if pictureElement is not None:
			imageData = QByteArray.fromBase64(str(pictureElement.text))
			image = QPixmap()
			image.loadFromData(imageData, Config.CHARACTER_PIC_FORMAT)
			self.__character.picture = image
开发者ID:GoliathLeviathan,项目名称:SoulCreator,代码行数:13,代码来源:ReadXmlCharacter.py

示例5: setvalue

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def setvalue(self, value):
        if self.savetofile and isinstance(value, basestring):
            self.filename = value

        if isinstance(value, QPixmap):
            self.widget.loadImage(value, fromfile=self.savetofile)
            return

        if self.tobase64 and value:
            value = QByteArray.fromBase64(value)

        self.widget.loadImage(value, fromfile=self.savetofile)
开发者ID:HeatherHillers,项目名称:RoamMac,代码行数:14,代码来源:imagewidget.py

示例6: try_image

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def try_image(value):
        _, extension = os.path.splitext(value)
        if extension[1:].lower() in supportedformats:
            if not os.path.exists(value):
                value = os.path.join(kwargs.get('imagepath', ''), value)
            return image_handler(key, value, imagetype='file')

        base64 = QByteArray.fromBase64(value)
        image = QPixmap()
        loaded = image.loadFromData(base64)
        if loaded:
            return image_handler(key, base64, imagetype='base64')
开发者ID:HeatherHillers,项目名称:RoamMac,代码行数:14,代码来源:htmlviewer.py

示例7: bmp_to_pixmap

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
def bmp_to_pixmap(path):
    if image_data is not None:
        data = QByteArray.fromBase64(image_data[path][1])
        pixmap = QPixmap()
        pixmap.loadFromData(data, image_data[path][0])
    else:
        absolute_path = os.path.join(get_program_path(), path)
        pixmap = QPixmap(absolute_path)

    mask1 = pixmap.createMaskFromColor(QColor(0xFF, 0x00, 0xF0), Qt.MaskInColor)
    pixmap.setMask(mask1)

    return pixmap
开发者ID:karstenerhardt,项目名称:brickv,代码行数:15,代码来源:bmp_to_pixmap.py

示例8: string_handler

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
def string_handler(key, value):
    global supportedformats
    if not supportedformats:
        supportedformats = [f.data() for f in QImageReader.supportedImageFormats()]

    base64 = QByteArray.fromBase64(value)
    image = QPixmap()
    loaded = image.loadFromData(base64)
    if loaded:
        return image_handler(key, base64, imagetype='base64')
    _, extension = os.path.splitext(value)
    if extension[1:] in supportedformats:
        return image_handler(key, value, imagetype='file')

    return value
开发者ID:henriquespedro,项目名称:Roam,代码行数:17,代码来源:htmlviewer.py

示例9: setvalue

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def setvalue(self, value):
        if self.tobase64 and value and not isinstance(value, QPixmap):
            value = QByteArray.fromBase64(value)

        self.widget.loadImage(value)
开发者ID:henriquespedro,项目名称:Roam,代码行数:7,代码来源:imagewidget.py

示例10: __init__

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def __init__(self, name, l, uid, new=False, parent=None):
        super(EditDialog, self).__init__(parent)

        self.name = name
        self.uid = uid
        self.l = l
        self.error = False
        self.image = None

        try:
            res = l.search_s(
                    "uid={l:s},{dn:s}".format(l=uid, dn=ldap_dn),
                    ldap.SCOPE_SUBTREE,
                    "objectclass=*",
                            )
            edit_form = []
            keys = res[0][1].keys()
            keys.sort()
            for key in keys:
                is_editable = True
                if key == jpegPhoto:
                    jpeg = res[0][1][key][0]
                    jpba = QByteArray.fromBase64(jpeg)
                    self.image = QImage.fromData(jpba, "JPG")
                for not_edit in not_editable:
                    if key == not_edit: is_editable = False
                edit_form.append((key+":", key, res[0][1][key], is_editable))

            frameLayout = QVBoxLayout()
            editLayout = QHBoxLayout()
            iconLayout = QHBoxLayout()
            self.iconLabel = QLabel()
            if self.image is not None:
                self.iconLabel.setPixmap(QPixmap.fromImage(self.image))
                buttonText = _("Change picture")
            else:
                buttonText = _("Insert picture")
            self.iconButton = QPushButton(buttonText)
            self.iconButton.setFocusPolicy(Qt.NoFocus)
            self.connect(self.iconButton, SIGNAL("clicked()"), self.editImage)
            iconLayout.addStretch()
            iconLayout.addWidget(self.iconLabel)
            iconLayout.addWidget(self.iconButton)
            iconLayout.addStretch()
            frameLayout.addLayout(iconLayout)

            width = 4
            rowLayout = []
            for i in range(width):
                rowLayout.append(QVBoxLayout())
                editLayout.addLayout(rowLayout[i])

            i = 0
            self.result = []
            for labeltext, key, text, is_editable in edit_form:
                if is_editable:
                    is_single = False
                    for single in single_value:
                        if key == single: is_single = True
                    if not is_single: text.append("")
                    for t in text:
                        leLayout = QHBoxLayout()
                        label = QLabel(labeltext)
                        edit  = QLineEdit(t)
                        leLayout.addWidget(label)
                        leLayout.addWidget(edit)
                        rowLayout[i].addLayout(leLayout)
                        i += 1
                        if i == width: i = 0
                        self.result.append((key, edit, True))
                else:
                    self.result.append((key, text, False))
            for i in range(width):
                rowLayout[i].addStretch()

            button2Layout = QHBoxLayout()
            button2Layout.addStretch()
            for text, slot, icon in ((_("Save"), self.close,
                                      "dialog-ok-apply.png"),
                                     (_("Cancel"), self.cancel,
                                      "dialog-cancel.png"),
                                    ):
                button = QPushButton(text)
                button.setFocusPolicy(Qt.NoFocus)
                if icon != "":
                    button.setIcon(QIcon(os.path.join(imagespath,icon)))
                button2Layout.addWidget(button)
                self.connect(button, SIGNAL("clicked()"), slot)
            button2Layout.addStretch()
            frameLayout.addLayout(editLayout)

            layout = QVBoxLayout()
            layout.addLayout(frameLayout)
            layout.addLayout(button2Layout)

            self.setLayout(layout)
            self.setWindowTitle(self.name)

        except ldap.LDAPError, e:
            error_msg(self, _("LDAP Error"), e)
开发者ID:jedamus,项目名称:vim-python,代码行数:102,代码来源:edit_ldap_vim.py

示例11: endSaveDocument

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
 def endSaveDocument(self, dataAsBaseSixFourString):
     self.documentData = QByteArray.fromBase64(dataAsBaseSixFourString)
     self.documentDataChanged.emit()
开发者ID:kogmbh,项目名称:blink-qt,代码行数:5,代码来源:webodfwidget.py

示例12: print

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    newFile.open(QIODevice.WriteOnly)
    newFile.write(reply.readAll())
    newFile.close()
    print("done")
    reply.deleteLater()

def read_data(reply):
    messageBuffer += reply.readAll()

# ---- Main ----------------------------------------------------


# print(dir(manager))
#manager.finished.connect( handle_download )

# with a simple web page
#url = "https://www.nextinpact.com/news/103770-google-annonce-android-o-liste-nouveautes-developer-preview-disponible.htm"
#request_download(manager, url)

# with an authenticated API request
req_token = ask_for_token(api_id, api_secret)
token_reply = manager.post(req_token[0], req_token[1])
#token_reply.finished.connect(
#     partial(self.handle_token, answer=token_reply))
token_reply.finished.connect(
                partial(self.handle_token, answer=token_reply))
bytarray = token_reply.readAll()
print("bbibit", bytarray, dir(bytarray))
content = str(bytarray)
parsed_content = json.loads(QByteArray.fromBase64(bytarray))
print(parsed_content)
开发者ID:isogeo,项目名称:isogeo-plugin-qgis,代码行数:33,代码来源:test_download_file.py

示例13: leftSplitterState

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
def leftSplitterState():
    """ Resonable default for splitter state with primary widget on the left.

    @return QByteArray suitable for use with QSplitter.restoreState
    """
    return QByteArray.fromBase64('AAAA/wAAAAAAAAACAAADQwAAAaUBAAAABgEAAAAB')
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:8,代码来源:defaults.py

示例14: setvalue

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def setvalue(self, value):
        if self.tobase64 and value:
            value = QByteArray.fromBase64(value)

        self.widget.loadImage(value)
开发者ID:NathanW2,项目名称:Roam,代码行数:7,代码来源:imagewidget.py

示例15: __init__

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import fromBase64 [as 别名]
    def __init__(self, mainWindow, renderThread, pluginConfig=None):
        QWidget.__init__(self, mainWindow)
        self.mainWindow = mainWindow
        self.renderThread = renderThread
        self.pluginConfig = pluginConfig

        # set up UI
        self.setupUi(self)

        self.databaseUrl = None
        if self.pluginConfig:
            self.includeSimilar = util.readConfigString(self.pluginConfig,
                "Component include similar", str(True)) != "False"
            self.includeVariants = util.readConfigString(self.pluginConfig, 
                "Component include variants", str(True)) != "False"

            self.databaseUrl = util.readConfigString(self.pluginConfig,
                "Update database url", None)

            splitterState = util.readConfigString(self.pluginConfig,
                "Component splitter", "")
            self.componentSplitter.restoreState(QByteArray.fromBase64(
                str(splitterState)))
        else:
            self.includeSimilar = True
            self.includeVariants = True

        if not self.databaseUrl:
            self.databaseUrl = unicode('sqlite:///'
                + util.getLocalData('dictionaries.db'))

        self.includeSimilarButton.setChecked(self.includeSimilar)
        self.includeVariantsButton.setChecked(self.includeVariants)

        self.componentViewScroll = 0
        self.selectedComponents = []
        self.language = None
        self.characterDomain = None

        # connect to main window
        self.connect(self.mainWindow, SIGNAL("settingsChanged()"),
            self.slotSettingsChanged)
        self.connect(self.mainWindow, SIGNAL("writeSettings()"),
            self.writeSettings)

        self.connect(self.renderThread, SIGNAL("jobFinished"),
            self.contentRendered)

        # connect to the widgets
        self.connect(self.includeVariantsButton, SIGNAL("clicked(bool)"),
            self.componentIncludeVariants)
        self.connect(self.includeSimilarButton, SIGNAL("clicked(bool)"),
            self.componentIncludeSimilar)

        self.connect(self.componentView, SIGNAL("linkClicked(const QUrl &)"),
            self.componentClicked)
        self.connect(self.componentView, SIGNAL("loadFinished(bool)"),
            self.componentViewLoaded)
        self.connect(self.componentResultView,
            SIGNAL("linkClicked(const QUrl &)"), self.componentResultClicked)
        self.connect(self.componentEdit,
            SIGNAL("textChanged(const QString &)"),
            self.componentEditChanged)

        self.componentView.page().setLinkDelegationPolicy(
            QWebPage.DelegateAllLinks)
        self.componentResultView.page().setLinkDelegationPolicy(
            QWebPage.DelegateAllLinks)

        self.initialised = False
开发者ID:cburgmer,项目名称:eclectus,代码行数:72,代码来源:componentpage.py


注:本文中的PyQt4.QtCore.QByteArray.fromBase64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。