-
Notifications
You must be signed in to change notification settings - Fork 2
/
GetCouplingCapStats.lym
69 lines (55 loc) · 1.94 KB
/
GetCouplingCapStats.lym
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?xml version="1.0" encoding="utf-8"?>
<klayout-macro>
<description/>
<version/>
<category>pymacros</category>
<prolog/>
<epilog/>
<doc/>
<autorun>false</autorun>
<autorun-early>false</autorun-early>
<shortcut/>
<show-in-menu>false</show-in-menu>
<group-name/>
<menu-path/>
<interpreter>python</interpreter>
<dsl-interpreter-name/>
<text>import pya
class NBRCouplerDialog(pya.QDialog):
"""
This class implements a dialog with a text display area and a
calculate button
"""
def button_clicked(self, checked):
""" Event handler: "Calculate" button clicked """
# Get the current layout view
lv = pya.Application.instance().main_window().current_view()
if lv is None:
self.text.setText("No view")
return
# Get the current cell view (the layout)
cv = lv.active_cellview()
if cv is None:
self.text.setText("No active cell view")
return
# The rest of your code goes here...
def __init__(self, parent = None):
""" Dialog constructor """
super(NBRCouplerDialog, self).__init__()
self.setWindowTitle("NBRCoupler Overlap and Separation")
self.resize(400, 120)
layout = pya.QVBoxLayout(self)
self.setLayout(layout)
self.text = pya.QLabel("Press the button to calculate overlap and separation", self)
layout.addWidget(self.text)
button = pya.QPushButton('Calculate', self)
button.setFont(pya.QFont('Times', 18, pya.QFont.Bold))
layout.addWidget(button)
# attach the event handler
button.clicked(self.button_clicked)
# Instantiate the dialog and make it visible initially.
# Passing the main_window will make it stay on top of the main window.
dialog = NBRCouplerDialog(pya.Application.instance().main_window())
dialog.show()
</text>
</klayout-macro>