프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / DTI_PID / App.py @ d45df999

이력 | 보기 | 이력해설 | 다운로드 (2.25 KB)

1 fb385cac humkyung
# coding: utf-8
2 a655d25c humkyung
"""
3
    This is application module
4
"""
5 fb385cac humkyung
import sys
6
import os
7
8
from PyQt5.QtCore import *
9
from PyQt5.QtGui import *
10
from PyQt5.QtWidgets import *
11 36cf5a45 gaqhf
from PyQt5.QtXml import *
12 fb385cac humkyung
from PyQt5.QtSvg import *
13 0a9e44a7 humkyung
from PyQt5 import QtWidgets
14 fb385cac humkyung
15 a4707ffe humkyung
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
16 fb385cac humkyung
from AppDocData import AppDocData
17
18
class App(QApplication):
19 a4707ffe humkyung
    """
20
    This is App class inherits from QApplication
21
    """
22 fb385cac humkyung
    def __init__(self, args):
23
        super(App, self).__init__(args)
24
        appStyle = AppDocData.instance().loadAppStyle()
25
        self.setStyle(appStyle)
26
        self.loadStyleSheet(os.path.dirname(os.path.realpath(__file__)) + '\\coffee')
27
28 0a9e44a7 humkyung
        self._mainWnd = None
29
30
        QtWidgets.qApp = self
31 fb385cac humkyung
32
    '''
33
        @brief  load application style sheet
34
        @author humkyung
35
        @date   2018.04.07
36
    '''
37
    def loadStyleSheet(self, sheetName):
38 93ddbbd7 humkyung
        try:
39
            file = QFile('%s.qss' % sheetName.lower())
40
            file.open(QFile.ReadOnly)
41 fb385cac humkyung
42 93ddbbd7 humkyung
            styleSheet = file.readAll()
43
            styleSheet = str(styleSheet, encoding='utf8')
44 fb385cac humkyung
45 93ddbbd7 humkyung
            self.setStyleSheet(styleSheet)
46
        finally:
47
            file.close()
48 fb385cac humkyung
49 d45df999 esham21
    ''' 
50 0a9e44a7 humkyung
        @brief      create hmb data from database record
51
        @author     humkyung
52
        @date       2018.07.12
53
    '''
54
    @staticmethod
55
    def mainWnd():
56
        return QtWidgets.qApp._mainWnd 
57
58 2894ed79 김정우
'''
59
    @history    18.04.23    Jeongwoo    Change method to execute ProjectDialog(dlg.exec_()→dlg.showDialog())
60
'''
61 fb385cac humkyung
if __name__ == '__main__':
62 0f542e23 humkyung
    import cv2
63 fb385cac humkyung
    from ProjectDialog import Ui_Dialog
64
    from MainWindow import MainWindow
65
66 0f542e23 humkyung
    '''
67
    img = cv2.imread('d:/Projects/DTIPID/HEC/drawings/HEC_P1_600DPI.png')
68
    img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 127, 255, cv2.THRESH_BINARY)[1]
69 c96518e7 esham21
    cv2.imwrite('d:/Projects/DTIPID/HEC/drawings/HEC_P1_600DPI_.png', img)6
70 0f542e23 humkyung
    '''
71
72 fb385cac humkyung
    app = App(sys.argv)
73
    try:
74
        dlg = Ui_Dialog()
75 b6406480 김정우
        selectedProject = dlg.showDialog()
76
        if selectedProject is not None:
77
            AppDocData.instance().setCurrentProject(selectedProject)
78 0a9e44a7 humkyung
            app._mainWnd = MainWindow.instance()
79
            app._mainWnd.show()
80 a4707ffe humkyung
            sys.exit(app.exec_())
81 fb385cac humkyung
    except Exception as ex:
82 265a1e83 esham21
         print('에러가 발생했습니다.\n', ex)
클립보드 이미지 추가 (최대 크기: 500 MB)