프로젝트

일반

사용자정보

개정판 dc620556

IDdc620556f8e480b2cb4b5da71db0302d2ce431c2
상위 a372ce6a
하위 eafaadaf, 35d6d96c

humkyung 이(가) 약 7년 전에 추가함

Add Digital PID.pptx

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
1 1
# coding: utf-8
2 2

  
3
import sys
3 4
import os
4 5
import sqlite3
5 6
from SingletonInstance import SingletonInstane
......
8 9

  
9 10
class AppDocData(SingletonInstane):
10 11
    '''
12
        @brief  return project database path
13
    '''
14
    def getPrjDatabasePath(self):
15
        return (os.path.dirname(os.path.realpath(__file__)) + "\\Project_db.db")
16

  
17
    '''
18
        @brief  get project list from database
19
    '''
20
    def getProjectList(self):
21
        from Project import Project
22

  
23
        projectList = []
24

  
25
        try:
26
            conn = sqlite3.connect(self.getPrjDatabasePath())
27
            cursor = conn.cursor()
28
            sql = 'SELECT * FROM Projects'
29
            try:
30
                cursor.execute(sql)
31
                rows = cursor.fetchall()
32
                for row in rows:
33
                    projectList.append(Project(row[0], row[1], row[2], row[3], row[4]))
34
            except Exception as ex:
35
                print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
36
        finally:
37
            conn.close()
38

  
39
        return projectList
40

  
41
    '''
11 42
        @brief  get sliding window size
12 43
    '''
13 44
    def getSlidingWindowSize(self):
14 45
        res = [10,10]
15 46
        try:
16 47
            # Creates or opens a file called mydb with a SQLite3 DB
17
            db = sqlite3.connect(DB_NAME)
48
            conn = sqlite3.connect(DB_NAME)
18 49
            # Get a cursor object
19
            cursor = db.cursor()
50
            cursor = conn.cursor()
20 51

  
21 52
            sql = "select * from configuration where section='Sliding Window'"
22 53
            cursor.execute(sql)
......
29 60
        # Catch the exception
30 61
        except Exception as e:
31 62
            # Roll back any change if something goes wrong
32
            db.rollback()
63
            conn.rollback()
33 64
            raise e
34 65
        finally:
35 66
            # Close the db connection
36
            db.close()
67
            conn.close()
37 68
        
38 69
        return res
39 70

  
DTI_PID/DTI_PID/DTI_PID_UI.py
54 54
        self.tabWidget.setObjectName("tabWidget")
55 55
        self.Symbol = QtWidgets.QWidget()
56 56
        self.Symbol.setObjectName("Symbol")
57
        self.gridLayout_3 = QtWidgets.QGridLayout(self.Symbol)
58
        self.gridLayout_3.setObjectName("gridLayout_3")
59
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
60
        self.verticalLayout_2.setObjectName("verticalLayout_2")
61
        self.pushButtonCreateSymbol = QtWidgets.QPushButton(self.Symbol)
62
        self.pushButtonCreateSymbol.setObjectName("pushButtonCreateSymbol")
63
        self.verticalLayout_2.addWidget(self.pushButtonCreateSymbol)
64
        self.listView = QtWidgets.QListView(self.Symbol)
65
        self.listView.setObjectName("listView")
66
        self.verticalLayout_2.addWidget(self.listView)
67
        self.gridLayout_3.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
57 68
        self.tabWidget.addTab(self.Symbol, "")
58 69
        self.Property = QtWidgets.QWidget()
59 70
        self.Property.setObjectName("Property")
......
114 125
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
115 126
        self.menu.setTitle(_translate("MainWindow", "파일"))
116 127
        self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
128
        self.pushButtonCreateSymbol.setText(_translate("MainWindow", "생성"))
117 129
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Symbol), _translate("MainWindow", "심볼"))
118 130
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Property), _translate("MainWindow", "속성"))
119 131
        self.actionOpen.setText(_translate("MainWindow", "열기"))
DTI_PID/DTI_PID/ProjectDialog.py
21 21
        self.selectedProject = None
22 22
        self.setupUi(self)
23 23

  
24
    def loadProjectTable(self):
25
        print("loadProjectTable()")
26
        conn = sqlite3.connect(DB_NAME)
27
        cursor = conn.cursor()
28
        sql = 'SELECT * FROM Projects'
29
        projectList = []
30
        try:
31
            cursor.execute(sql)
32
            rows = cursor.fetchall()
33
            for row in rows:
34
                projectList.append(Project(row[0], row[1], row[2], row[3], row[4]))
35
        except:
36
            print("Can't find Projects Table : " + DB_NAME)
37
        conn.close()
38
        return projectList
39

  
40 24
    def setupUi(self, Dialog):
41 25
        Dialog.setObjectName("Dialog")
42 26
        Dialog.resize(417, 88)
......
81 65
        QtCore.QMetaObject.connectSlotsByName(Dialog)
82 66

  
83 67
    def initComboBox(self):
68
        from AppDocData import AppDocData
69

  
84 70
        self.comboBox.clear()
85
        projectList = self.loadProjectTable()
71
        projectList = AppDocData.instance().getProjectList()
86 72
        ## ComboBox setting
87 73
        for project in projectList:
88 74
            self.comboBox.addItem(project.getName(), project)
DTI_PID/DTI_PID/UI/Configuration.ui
97 97
              </item>
98 98
              <item>
99 99
               <widget class="QPushButton" name="pushButton">
100
                <property name="minimumSize">
101
                 <size>
102
                  <width>50</width>
103
                  <height>0</height>
104
                 </size>
105
                </property>
106
                <property name="maximumSize">
107
                 <size>
108
                  <width>50</width>
109
                  <height>16777215</height>
110
                 </size>
111
                </property>
100 112
                <property name="text">
101 113
                 <string>추가</string>
102 114
                </property>
DTI_PID/DTI_PID/UI/DTI__PID.ui
97 97
        <attribute name="title">
98 98
         <string>심볼</string>
99 99
        </attribute>
100
        <layout class="QGridLayout" name="gridLayout_3">
101
         <item row="0" column="0">
102
          <layout class="QVBoxLayout" name="verticalLayout_2">
103
           <item>
104
            <widget class="QPushButton" name="pushButtonCreateSymbol">
105
             <property name="text">
106
              <string>생성</string>
107
             </property>
108
            </widget>
109
           </item>
110
           <item>
111
            <widget class="QListView" name="listView"/>
112
           </item>
113
          </layout>
114
         </item>
115
        </layout>
100 116
       </widget>
101 117
       <widget class="QWidget" name="Property">
102 118
        <attribute name="title">

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)