프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / DTI_PID / App.py @ d45df999

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

1
# coding: utf-8
2
"""
3
    This is application module
4
"""
5
import sys
6
import os
7

    
8
from PyQt5.QtCore import *
9
from PyQt5.QtGui import *
10
from PyQt5.QtWidgets import *
11
from PyQt5.QtXml import *
12
from PyQt5.QtSvg import *
13
from PyQt5 import QtWidgets
14

    
15
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
16
from AppDocData import AppDocData
17

    
18
class App(QApplication):
19
    """
20
    This is App class inherits from QApplication
21
    """
22
    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
        self._mainWnd = None
29

    
30
        QtWidgets.qApp = self
31

    
32
    '''
33
        @brief  load application style sheet
34
        @author humkyung
35
        @date   2018.04.07
36
    '''
37
    def loadStyleSheet(self, sheetName):
38
        try:
39
            file = QFile('%s.qss' % sheetName.lower())
40
            file.open(QFile.ReadOnly)
41

    
42
            styleSheet = file.readAll()
43
            styleSheet = str(styleSheet, encoding='utf8')
44

    
45
            self.setStyleSheet(styleSheet)
46
        finally:
47
            file.close()
48

    
49
    ''' 
50
        @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
'''
59
    @history    18.04.23    Jeongwoo    Change method to execute ProjectDialog(dlg.exec_()→dlg.showDialog())
60
'''
61
if __name__ == '__main__':
62
    import cv2
63
    from ProjectDialog import Ui_Dialog
64
    from MainWindow import MainWindow
65

    
66
    '''
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
    cv2.imwrite('d:/Projects/DTIPID/HEC/drawings/HEC_P1_600DPI_.png', img)6
70
    '''
71

    
72
    app = App(sys.argv)
73
    try:
74
        dlg = Ui_Dialog()
75
        selectedProject = dlg.showDialog()
76
        if selectedProject is not None:
77
            AppDocData.instance().setCurrentProject(selectedProject)
78
            app._mainWnd = MainWindow.instance()
79
            app._mainWnd.show()
80
            sys.exit(app.exec_())
81
    except Exception as ex:
82
         print('에러가 발생했습니다.\n', ex)
클립보드 이미지 추가 (최대 크기: 500 MB)