hytos / DTI_PID / DTI_PID / ConfigurationLineNoDialog.py @ a2e3cd0c
이력 | 보기 | 이력해설 | 다운로드 (2.29 KB)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
|
3 |
# Form implementation generated from reading ui file 'ProjectDialog.ui'
|
4 |
#
|
5 |
# Created by: PyQt5 UI code generator 5.6
|
6 |
#
|
7 |
# WARNING! All changes made in this file will be lost!
|
8 |
|
9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
10 |
from PyQt5.QtWidgets import * |
11 |
import os |
12 |
from Project import Project |
13 |
from AppDocData import AppDocData |
14 |
import Configuration_LineNo_UI |
15 |
|
16 |
class QConfigurationLineNoDialog(QDialog): |
17 |
def __init__(self, parent, isAdd, lineNo=None): |
18 |
QDialog.__init__(self, parent)
|
19 |
|
20 |
self.ui = Configuration_LineNo_UI.Ui_Dialog()
|
21 |
self.ui.setupUi(self) |
22 |
self.isAdd = isAdd
|
23 |
self.lineNo = lineNo
|
24 |
self.isAccepted = False |
25 |
self.newLineNo = None |
26 |
if not self.isAdd: |
27 |
self.setWindowTitle(self.tr('Edit')) |
28 |
|
29 |
|
30 |
|
31 |
def showDialog(self): |
32 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowCloseButtonHint & ~QtCore.Qt.WindowContextHelpButtonHint) |
33 |
self.exec_()
|
34 |
return self.isAccepted, self.newLineNo |
35 |
|
36 |
def accept(self): |
37 |
appDocData = AppDocData.instance() |
38 |
self.newColName = self.ui.lineEdit.text() |
39 |
|
40 |
if not self.validationCheck(self.newColName): |
41 |
QMessageBox.warning(self, self.tr('INFO'), self.tr('Please check column name')) |
42 |
return
|
43 |
self.isAccepted = True |
44 |
|
45 |
if self.isAdd: |
46 |
self.newHistory = (None, self.newColName) |
47 |
#if appDocData.add_column_into_table(self.tableName, self.ui.lineEdit.text()):
|
48 |
# self.isAccepted = True
|
49 |
# QDialog.accept(self)
|
50 |
#else:
|
51 |
# QDialog.reject(self)
|
52 |
else:
|
53 |
self.newHistory = (self.oldColName, self.newColName) |
54 |
#if appDocData.edit_column_Name_in_table(self.tableName, self.oldColName, self.ui.lineEdit.text()):
|
55 |
# self.isAccepted = True
|
56 |
# QDialog.accept(self)
|
57 |
#else:
|
58 |
# QDialog.reject(self)
|
59 |
|
60 |
QDialog.accept(self)
|
61 |
|
62 |
def reject(self): |
63 |
QDialog.reject(self)
|
64 |
|
65 |
def validationCheck(self, colName): |
66 |
if colName == '': |
67 |
return False |
68 |
for col in self.colList: |
69 |
if col == colName:
|
70 |
return False |
71 |
for record in self.history: |
72 |
if record[1] == colName: |
73 |
return False |
74 |
return True |