Exemplo n.º 1
0
    def loadIni(self, iniFile):
        self.columnHeaders = {}
        super().loadIni(iniFile);
        ini = QSettings(iniFile, QSettings.IniFormat)
        ini.setIniCodec('utf-8')

        ini.beginGroup("DB")
        self.dbini = ini.value("DBConnect")
        if self.dbini == "this":
           self.dbini = iniFile
        self.dbini = util.nearFile(self.iniFile, self.dbini)
        ini.endGroup()

        ini.beginGroup("Run")
        if ini.contains("SQL"):
            self.sql = ini.value("SQL")
        else:
            scriptFile = ini.value("SQLScript")
            scriptFile = util.nearFile(self.iniFile, scriptFile)
            # print("scriptFile:", scriptFile)
            f = QFile(scriptFile)
            f.open(QIODevice.ReadOnly)
            self.sql = str(f.readAll(),'utf-8-sig')
        #print(bytes(self.sql,'utf-8'))
        ini.endGroup()
        ini.beginGroup("Columns")
        for key in ini.childKeys():
            self.columnHeaders[key.strip().upper()] = ini.value(key)
        ini.endGroup()
Exemplo n.º 2
0
    def loadIni(self, iniFile):
        super().loadIni(iniFile)
        ini = QSettings(iniFile, QSettings.IniFormat)
        ini.setIniCodec("utf-8")
        print(iniFile, ini.childGroups())
        ini.beginGroup("WebPage")
        self.url = ini.value('Url')
        self.bodyFile = ini.value('Body')
        self.method = ini.value('Method')
        if self.method is None:
            self.method = 'get' if self.bodyFile == None else 'post'
        if self.bodyFile:
            self.bodyFile = cu.nearFile(iniFile, self.bodyFile)

##        print(self.method)
        self.transformTemplate = ini.value('Transform')
        if self.transformTemplate:
            self.transformTemplate = cu.nearFile(iniFile,
                                                 self.transformTemplate)
        ini.endGroup()
Exemplo n.º 3
0
    def loadIni(self, iniFile):
        super().loadIni(iniFile)
        ini = QSettings(iniFile, QSettings.IniFormat)

        ini.beginGroup("DB")
        self.dbini = ini.value("DBConnect")
        if self.dbini == "this":
            self.dbini = iniFile
        self.dbini = util.nearFile(self.iniFile, self.dbini)
        ini.endGroup()

        ini.beginGroup("Run")
        if ini.contains("SQL"):
            self.sql = ini.value("SQL")
        else:
            scriptFile = ini.value("SQLScript")
            scriptFile = util.nearFile(self.iniFile, scriptFile)
            # print("scriptFile:", scriptFile)
            f = QFile(scriptFile)
            f.open(QIODevice.ReadOnly)
            self.sql = str(f.readAll(), 'utf-8-sig')
        ini.endGroup()
Exemplo n.º 4
0
 def __init__(self, iniFile, parent=None):
     super().__init__(parent)
     self.statusChanged = self.showStatus
     self.setMinimumSize(QSize(100,100))
     self.setResizeMode(self.SizeRootObjectToView)
     pyqt = os.path.dirname(PyQt5.__file__)
     p = os.path.join(pyqt, "Qt", "qml")
     self.engine().addImportPath(p)
     ini = QSettings(iniFile, QSettings.IniFormat)
     ini.setIniCodec("utf-8")
     ini.beginGroup("QML")
     self.qml = ini.value("Source")
     if not self.qml is None:
         self.qml = QUrl.fromUserInput(util.nearFile(iniFile, self.qml))
         self.setSource(QUrl(self.qml))
     else:
         print("No source qml")
Exemplo n.º 5
0
            self.view = QTableView(self)
            vh = self.view.verticalHeader()
            vh.setDefaultSectionSize(19)
            self.view.setSortingEnabled(True)
            self.view.horizontalHeader().setSectionsMovable(True)
            self.view.horizontalHeader().setSortIndicator(
                -1, Qt.AscendingOrder)
            self.resultLay.addWidget(self.view)
            self.view.sqlModel = None
            self.view.proxyModel = None
        if not self.view.sqlModel:
            self.view.sqlModel = self.createModel(self.view)
        if self.proxyEnabled:
            if not self.view.proxyModel:
                self.view.proxyModel = QSortFilterProxyModel(self.view)
                self.view.proxyModel.setDynamicSortFilter(True)
                self.view.proxyModel.setSortRole(Qt.EditRole)
            self.view.proxyModel.setSourceModel(self.view.sqlModel)
            self.view.setModel(self.view.proxyModel)
        else:
            self.view.setModel(self.view.sqlModel)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ini = util.nearFile(__file__, "../data/sqlite/test-sqlite.ini")
    ex = SqlExecutor(ini)
    ex.show()

    sys.exit(app.exec_())