프로젝트

일반

사용자정보

개정판 491572ed

ID491572ed7b1c81fd583c66529f4230662c7f5d3a
상위 f6ff1533
하위 8aee9f19

함의성이(가) 8달 전에 추가함

symbol scale

Change-Id: I92acfdb298b87dbd4591baf3c60805bed15ede16

차이점 보기:

DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
1533 1533
    def contextScale(self):
1534 1534
        from EngineeringEquipmentItem import QEngineeringEquipmentItem
1535 1535

  
1536
        text, result = QInputDialog.getDouble(None, self.tr('Symbol Scale'), self.tr('Input : '), self.scale(), 0.30, 100, 2, Qt.WindowFlags(), 0.01)
1537
		
1538
        try:
1536
        if type(self) is not QEngineeringEquipmentItem:
1537
            text, result = QInputDialog.getDouble(None, self.tr('Symbol Scale'), self.tr('Value : '), self.scale(), 0.30, 100, 2, Qt.WindowFlags(), 0.01)
1539 1538
            if result:
1540 1539
                scale = round(float(text), 3)
1541 1540
                if 0.30 <= scale < 100:
1542
                    symbols = [item for item in self.scene().items() if issubclass(type(item), SymbolSvgItem) and type(item) is not QEngineeringEquipmentItem]
1541
                    symbols = [item for item in self.scene().selectedItems() if issubclass(type(item), SymbolSvgItem) and type(item) is not QEngineeringEquipmentItem]
1543 1542
                    for symbol in symbols:
1544 1543
                        symbol.setScale(scale)
1545
        except:
1546
            return
1544
        else:
1545
            dlg = SymbolScaleDialog(None, abs(self.transform().m11()), abs(self.transform().m22()))
1546
            if dlg.showDialog() and (0.30 <= dlg.ui.doubleSpinBoxX.value() <= 20) and (0.30 <= dlg.ui.doubleSpinBoxY.value() <= 20):
1547
                transform = QTransform().translate(self.symbolOrigin[0], self.symbolOrigin[1])
1548
                if self.flip == 1:
1549
                    transform.scale(-dlg.ui.doubleSpinBoxX.value(), dlg.ui.doubleSpinBoxY.value())
1550
                else:
1551
                    transform.scale(dlg.ui.doubleSpinBoxX.value(), dlg.ui.doubleSpinBoxY.value())
1552
                transform.translate(-self.symbolOrigin[0], -self.symbolOrigin[1])
1553
                self.setTransform(transform)            
1547 1554

  
1548 1555
    def contextSelectAll(self):
1549 1556
        from App import App
......
3059 3066
        QObject.__init__(self, parent)
3060 3067

  
3061 3068

  
3069
class SymbolScaleDialog(QDialog):
3070
    def __init__(self, parent, scaleX, scaleY):  # Parent is MainWindow
3071
        import SymbolScale_UI
3072
        from AppDocData import AppDocData
3073

  
3074
        QDialog.__init__(self, parent)
3075
        self.ui = SymbolScale_UI.Ui_SymbolScaleDialog()
3076
        self.ui.setupUi(self)
3077

  
3078
        self.ui.doubleSpinBoxX.setValue(scaleX)
3079
        self.ui.doubleSpinBoxY.setValue(scaleY)
3080

  
3081
    def showDialog(self):
3082
        res = self.exec_()
3083
        return res
3084

  
3085

  
3062 3086
if __name__ == '__main__':
3063 3087
    f = QFile('d:/Projects/DTIPID/DTI_PID/DTI_PID/SG_TEST/svg/ANGLE VALVE.svg')
3064 3088
    f.open(QIODevice.ReadOnly)
DTI_PID/DTI_PID/UI/SymbolScale.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>SymbolScaleDialog</class>
4
 <widget class="QDialog" name="SymbolScaleDialog">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>300</width>
10
    <height>91</height>
11
   </rect>
12
  </property>
13
  <property name="minimumSize">
14
   <size>
15
    <width>300</width>
16
    <height>79</height>
17
   </size>
18
  </property>
19
  <property name="maximumSize">
20
   <size>
21
    <width>650</width>
22
    <height>150</height>
23
   </size>
24
  </property>
25
  <property name="font">
26
   <font>
27
    <family>맑은 고딕</family>
28
    <weight>75</weight>
29
    <bold>true</bold>
30
   </font>
31
  </property>
32
  <property name="windowTitle">
33
   <string>Symbol Scale</string>
34
  </property>
35
  <layout class="QVBoxLayout" name="verticalLayout">
36
   <item>
37
    <layout class="QGridLayout" name="gridLayout">
38
     <item row="0" column="3">
39
      <widget class="QDoubleSpinBox" name="doubleSpinBoxY">
40
       <property name="minimum">
41
        <double>0.300000000000000</double>
42
       </property>
43
       <property name="maximum">
44
        <double>20.000000000000000</double>
45
       </property>
46
       <property name="singleStep">
47
        <double>0.010000000000000</double>
48
       </property>
49
      </widget>
50
     </item>
51
     <item row="0" column="2">
52
      <widget class="QLabel" name="label">
53
       <property name="font">
54
        <font>
55
         <family>맑은 고딕</family>
56
         <pointsize>10</pointsize>
57
         <weight>75</weight>
58
         <bold>true</bold>
59
        </font>
60
       </property>
61
       <property name="text">
62
        <string>Y : </string>
63
       </property>
64
      </widget>
65
     </item>
66
     <item row="0" column="1">
67
      <widget class="QDoubleSpinBox" name="doubleSpinBoxX">
68
       <property name="minimum">
69
        <double>0.300000000000000</double>
70
       </property>
71
       <property name="maximum">
72
        <double>20.000000000000000</double>
73
       </property>
74
       <property name="singleStep">
75
        <double>0.010000000000000</double>
76
       </property>
77
      </widget>
78
     </item>
79
     <item row="0" column="0">
80
      <widget class="QLabel" name="label_2">
81
       <property name="text">
82
        <string>X : </string>
83
       </property>
84
      </widget>
85
     </item>
86
    </layout>
87
   </item>
88
   <item>
89
    <widget class="QLabel" name="errorLabel">
90
     <property name="maximumSize">
91
      <size>
92
       <width>16777215</width>
93
       <height>0</height>
94
      </size>
95
     </property>
96
     <property name="styleSheet">
97
      <string notr="true"/>
98
     </property>
99
     <property name="text">
100
      <string/>
101
     </property>
102
     <property name="alignment">
103
      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
104
     </property>
105
    </widget>
106
   </item>
107
   <item>
108
    <widget class="QDialogButtonBox" name="buttonBox">
109
     <property name="font">
110
      <font>
111
       <family>맑은 고딕</family>
112
       <weight>75</weight>
113
       <bold>true</bold>
114
      </font>
115
     </property>
116
     <property name="standardButtons">
117
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
118
     </property>
119
    </widget>
120
   </item>
121
  </layout>
122
 </widget>
123
 <resources/>
124
 <connections>
125
  <connection>
126
   <sender>buttonBox</sender>
127
   <signal>rejected()</signal>
128
   <receiver>SymbolScaleDialog</receiver>
129
   <slot>reject()</slot>
130
   <hints>
131
    <hint type="sourcelabel">
132
     <x>299</x>
133
     <y>79</y>
134
    </hint>
135
    <hint type="destinationlabel">
136
     <x>299</x>
137
     <y>49</y>
138
    </hint>
139
   </hints>
140
  </connection>
141
  <connection>
142
   <sender>buttonBox</sender>
143
   <signal>accepted()</signal>
144
   <receiver>SymbolScaleDialog</receiver>
145
   <slot>accept()</slot>
146
   <hints>
147
    <hint type="sourcelabel">
148
     <x>299</x>
149
     <y>79</y>
150
    </hint>
151
    <hint type="destinationlabel">
152
     <x>299</x>
153
     <y>49</y>
154
    </hint>
155
   </hints>
156
  </connection>
157
 </connections>
158
</ui>

내보내기 Unified diff

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