コード例 #1
0
 def update_t(self, a):
     if self.mySQL.do:
         da_3 = QDialog(self.app)
         d_list = []
         if self.table_Name != None:
             da_3.setWindowTitle("Update Table %s.%s" %
                                 (self.Data_Name, self.table_Name))
             da_3.resize(600, 100)
             tab = WTL.Table()
             line_1 = QLineEdit()
             line_2 = QLineEdit()
             but = QPushButton("Update")
             tab.setRowCount(1)
             cols = self.mySQL.getColumns(self.Data_Name, self.table_Name)
             tab.setColumnCount(len(cols))
             for ind in range(len(cols)):
                 item = QTableWidgetItem
                 tab.setHorizontalHeaderItem(ind, item(cols[ind]))
             vbox = QVBoxLayout(da_3)
             hbox = QHBoxLayout()
             vbox.addWidget(tab)
             for i in (QLabel("Where: "), line_1, QLabel("="), line_2):
                 hbox.addWidget(i)
             vbox.addLayout(hbox)
             vbox.addWidget(but)
             but.clicked.connect(lambda: self.mySQL.update_DT(
                 self.Data_Name, self.table_Name,
                 str(line_1.text() + "='%s'" % line_2.text()), tab))
             self.app.ref = True
             da_3.exec_()
         else:
             MsgBox_2().showMsg("Plz Select Table From %s" % self.Data_Name)
     else:
         MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
コード例 #2
0
    def insert_t(self, a):
        if self.mySQL.do:
            da_3 = QDialog(self.app)
            if self.table_Name != None:
                da_3.setWindowTitle("Insert InTo %s.%s" %
                                    (self.Data_Name, self.table_Name))
                da_3.resize(600, 100)
                tab = WTL.Table()
                but = QPushButton("Inset")
                tab.setRowCount(1)
                cols = self.mySQL.getColumns(self.Data_Name, self.table_Name)
                tab.setColumnCount(len(cols))
                for ind in range(len(cols)):
                    item = QTableWidgetItem
                    tab.setHorizontalHeaderItem(ind, item(cols[ind]))
                vbox = QVBoxLayout(da_3)
                vbox.addWidget(tab)
                vbox.addWidget(but)
                but.clicked.connect(lambda: self.mySQL.insert_DT(
                    self.Data_Name, self.table_Name, tab))
                self.app.ref = True
                da_3.exec_()
            else:
                MsgBox_2().showMsg("Plz Select Table %s" % self.Data_Name)

        else:
            MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
コード例 #3
0
ファイル: report.py プロジェクト: tinavas/FSERP
 def image_viewer(self, event=None):
     """pops up a image viewer to check the details"""
     dialog = QDialog()
     dialog.setWindowFlags(Qt.WindowTitleHint | Qt.WindowStaysOnTopHint)
     layout = QHBoxLayout(dialog)
     label = QLabel(dialog)
     # self.pixmap.scaled(self.image_label.size(), Qt.KeepAspectRatio, Qt.FastTransformation)
     label.setPixmap(self.pixmap)
     label.setScaledContents(True)
     layout.addWidget(label)
     dialog.exec_()
コード例 #4
0
 def add_col(self, a):
     if self.mySQL.do:
         da_2 = QDialog(self.app)
         if self.table_Name != None:
             self.app.ref = True
             da_2.setWindowTitle("Delete Column From %s.%s" %
                                 (self.Data_Name, self.table_Name))
             da_2.setFixedSize(600, 50)
             line_1 = edit.editText()
             but = QPushButton('ADD')
             hbox = QHBoxLayout(da_2)
             for i in (QLabel("New Column: "), line_1, but):
                 hbox.addWidget(i)
             but.clicked.connect(lambda: self.mySQL.add_Tcol(
                 self.Data_Name, self.table_Name, line_1.toPlainText()))
             da_2.exec_()
         else:
             MsgBox_2().showMsg("Select  Table From %s" % self.Data_Name)
     else:
         MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
コード例 #5
0
 def drop_table(self, a):
     if self.mySQL.do:
         if self.Data_Name != None:
             da = QDialog(self.app)
             da.setWindowTitle("%s From %s" % (a.text(), self.Data_Name))
             da.setFixedSize(300, 100)
             form = QFormLayout(da)
             lin = QLineEdit()
             lin.setFont(QFont("", 14))
             but = QPushButton("Delete Table")
             but.clicked.connect(
                 lambda: self.mySQL.drop_table(self.Data_Name, lin.text()))
             form.addRow(QLabel("<h3>Name Table</h3>"), lin)
             form.setSpacing(30)
             form.addRow(but)
             self.app.ref = True
             da.exec_()
         else:
             MsgBox_2().showMsg("Plz Select Database")
     else:
         MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
コード例 #6
0
 def data(self, a):
     if self.mySQL.do:
         di_ac = {
             "Create Database": self.mySQL.create_data,
             "Delete Database": self.mySQL.drop_data,
         }
         da = QDialog(self.app)
         da.setFixedSize(300, 100)
         form = QFormLayout(da)
         lin = QLineEdit()
         lin.setFont(QFont("", 14))
         but = QPushButton("%s" % str(a.text()).split(' ')[0])
         but.clicked.connect(lambda: di_ac[a.text()](lin.text()))
         form.addRow(QLabel("<h3>Name Database</h3>"), lin)
         form.setSpacing(30)
         form.addRow(but)
         da.setWindowTitle("%s" % a.text())
         da.exec_()
         self.app.ref = True
     else:
         MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
コード例 #7
0
 def _table(self, a):
     if self.mySQL.do:
         da_2 = QDialog(self.app)
         if self.Data_Name != None:
             da_2.setWindowTitle("%s in %s" % (a.text(), self.Data_Name))
             da_2.resize(500, 280)
             line = QLineEdit()
             edi_t = edit.editText()
             but = QPushButton('Create')
             vbox = QVBoxLayout(da_2)
             form = QFormLayout()
             form.addRow(QLabel("Name Table"), line)
             vbox.addLayout(form)
             vbox.addWidget(edi_t)
             vbox.addWidget(but)
             but.clicked.connect(lambda: self.mySQL.create_table(
                 self.Data_Name, line.text(), edi_t.toPlainText()))
             self.app.ref = True
             da_2.exec_()
         else:
             MsgBox_2().showMsg("Plz Select Database ")
コード例 #8
0
 def rm_row(self, a):
     if self.mySQL.do:
         da_2 = QDialog(self.app)
         if self.table_Name != None:
             da_2.setWindowTitle("Delete Row From %s.%s" %
                                 (self.Data_Name, self.table_Name))
             da_2.setFixedSize(400, 50)
             line_1 = QLineEdit()
             line_2 = QLineEdit()
             but = QPushButton('Delete')
             hbox = QHBoxLayout(da_2)
             for i in (QLabel("Delete Where: "), line_1, QLabel("="),
                       line_2, but):
                 hbox.addWidget(i)
             but.clicked.connect(lambda: self.mySQL.delete_Trow(
                 self.Data_Name, self.table_Name,
                 str(line_1.text() + "='%s'" % line_2.text())))
             self.app.ref = True
             da_2.exec_()
         else:
             MsgBox_2().showMsg("Select  Table  From %s" % self.Data_Name)
     else:
         MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
コード例 #9
0
    tv = QTreeView(dialog)
    tv.setModel(model)
    tv.setAlternatingRowColors(True)
    layout.addWidget(tv)

    label = QLabel("Search for the following person")
    layout.addWidget(label)

    buts = []
    frame = QFrame(dialog)
    layout2 = QHBoxLayout(frame)

    for person in model.people:
        but = QPushButton(person.fname, frame)
        buts.append(but)
        layout2.addWidget(but)
        QObject.connect(but, SIGNAL("clicked()"), but_clicked)

    layout.addWidget(frame)

    but = QPushButton("Clear Selection")
    layout.addWidget(but)
    QObject.connect(but, SIGNAL("clicked()"), tv.clearSelection)

    QObject.connect(tv, SIGNAL("clicked (QModelIndex)"),
        row_clicked)

    dialog.exec_()

    app.closeAllWindows()
コード例 #10
0
    tv = QTreeView(dialog)
    tv.setModel(model)
    tv.setAlternatingRowColors(True)
    layout.addWidget(tv)

    label = QLabel("Search for the following person")
    layout.addWidget(label)

    buts = []
    frame = QFrame(dialog)
    layout2 = QHBoxLayout(frame)

    for person in model.people:
        but = QPushButton(person.fname, frame)
        buts.append(but)
        layout2.addWidget(but)
        QObject.connect(but, SIGNAL("clicked()"), but_clicked)

    layout.addWidget(frame)

    but = QPushButton("Clear Selection")
    layout.addWidget(but)
    QObject.connect(but, SIGNAL("clicked()"), tv.clearSelection)

    QObject.connect(tv, SIGNAL("clicked (QModelIndex)"), row_clicked)

    dialog.exec_()

    app.closeAllWindows()
コード例 #11
0
        return "{} {}".format(self.name, self.price)


# form_rendered._field_map['name'].set_value("king")
# form_rendered._field_map['price'].set_value("1337")

data = Data(name="King Kong", price=123)

d = {'list': ['alpha', 'beta', 'gamma'], 'group': data}

form_rendered = Render(form)
form_rendered.set_all_values(data)
form_rendered.read_all_values(data)
print(data)

d = QDialog()
view = PySide.QtWebKit.QWebView(d)
view.setZoomFactor(1.5)
# view.setHtml("Hello world <a href='eulu.html'>Link</a>")
# view.setUrl('file:///Users/stc/Dropbox/index.html')
view.setUrl(
    'file:///PORT-STC/PRIVATE/SlickGrid-2.2.6/examples/example14-highlighting.html'
)
top_layout = QHBoxLayout()
top_layout.addWidget(view)
top_layout.addLayout(form_rendered.render())
d.setLayout(top_layout)
d.show()

d.exec_()
コード例 #12
0
ファイル: ConfigDialog.py プロジェクト: uheee/FCY
    def matchResult(self, result):
        """
        显示匹配状态
        """
        isMatch = True
        match_num = 0

        def accept():
            if isMatch:
                self.passFlag = True
                dialog.accept()
                self.defaultConfig(False)
                self.close()
            else:
                self.passFlag = False
                dialog.reject()

        dialog = QDialog()
        ui = Ui_DialogMatch()
        ui.setupUi(dialog)
        ui.okButton.clicked.connect(accept)
        dialog.setModal(True)
        groupState = [
            ui.pressure1, ui.pressure2, ui.pressure3, ui.pressure4,
            ui.pressure5, ui.pressure6, ui.digital1, ui.digital2, ui.digital3,
            ui.digital4, ui.speed1, ui.speed2
        ]
        groupCheck = [
            self.pres_chk1, self.pres_chk2, self.pres_chk3, self.pres_chk4,
            self.pres_chk5, self.pres_chk6, self.num_chk1, self.num_chk2,
            self.num_chk3, self.num_chk4, self.speed_chk
        ]
        if not result:
            return
        else:
            for i, j in enumerate(result):
                if i < 11:
                    if result[i] == '0':
                        if groupCheck[i].isChecked():
                            groupState[i].setText(u'匹配')
                            palette = groupState[i].palette()
                            palette.setColor(QPalette.WindowText, Qt.green)
                            groupState[i].setPalette(palette)
                            match_num += 1
                        else:
                            groupState[i].setText(u'接通')
                            palette = groupState[i].palette()
                            palette.setColor(QPalette.WindowText, Qt.blue)
                            groupState[i].setPalette(palette)
                    else:
                        if groupCheck[i].isChecked():
                            groupState[i].setText(u'不匹配')
                            palette = groupState[i].palette()
                            palette.setColor(QPalette.WindowText, Qt.red)
                            groupState[i].setPalette(palette)
                            ui.okButton.setEnabled(False)
                            isMatch = False
                        else:
                            groupState[i].setText(u'断开')
                            palette = groupState[i].palette()
                            palette.setColor(QPalette.WindowText, Qt.gray)
                            groupState[i].setPalette(palette)
                else:
                    if result[i] == '0':
                        self.trigger_combo.setCurrentIndex(2)
                        groupState[i].setText(u'外触发启用')
                        palette = groupState[i].palette()
                        palette.setColor(QPalette.WindowText, Qt.green)
                        groupState[i].setPalette(palette)
                        match_num += 1
                    else:
                        if self.trigger_combo.currentIndex() == 2:
                            groupState[i].setText(u'不匹配')
                            palette = groupState[i].palette()
                            palette.setColor(QPalette.WindowText, Qt.red)
                            groupState[i].setPalette(palette)
                            ui.okButton.setEnabled(False)
                            isMatch = False
                        else:
                            groupState[i].setText(u'断开')
                            palette = groupState[i].palette()
                            palette.setColor(QPalette.WindowText, Qt.gray)
                            groupState[i].setPalette(palette)
            if isMatch:
                ui.linkState.setText(u'匹配成功,%d条线路匹配' % match_num)
            else:
                ui.linkState.setText(u'匹配失败,%d条线路匹配' % match_num)
            dialog.show()
            dialog.exec_()