Skip to content

Commit

Permalink
waveguide resize GUI improvements. #15
Browse files Browse the repository at this point in the history
units; merged the outputs into a read-only text field


Former-commit-id: b1edca7
  • Loading branch information
lukasc-ubc committed Apr 12, 2016
1 parent 3e83a74 commit 6998b60
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions klayout_dot_config/pymacros/SiEPIC_EBeam_waveguide_resize.lym
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ if is_waveguide == True:


# points = path_to_points(shape.path)
points = points_mult(path_to_Dpoints(wg_path_trans), 1)
points = points_mult(path_to_Dpoints(wg_path_trans), dbu)

segments = []
for i in range(len(points)-1):
Expand Down Expand Up @@ -231,24 +231,27 @@ if is_waveguide == True:
#titlefont = QFont("Arial", 9, QFont.Bold, False)
hbox = QVBoxLayout(wdg)

wdg.setFixedSize(650, 200)
wdg.setFixedSize(650, 250)

def selection(self):
#make a list of these to show them
global segments, seg_orientation
lf1text1.setText(str(abs(segments[parameters.currentIndex][0][0] - segments[parameters.currentIndex][1][0])*dbu + abs(segments[parameters.currentIndex][0][1] - segments[parameters.currentIndex][1][1])*dbu))
lf1text2.setText(str(seg_orientation[parameters.currentIndex]))
# lf1text1.setText(str(abs(segments[parameters.currentIndex][0][0] - segments[parameters.currentIndex][1][0])*dbu + abs(segments[parameters.currentIndex][0][1] - segments[parameters.currentIndex][1][1])*dbu))
lf1label1.setText (' Segment length: %s microns' % str(abs(segments[parameters.currentIndex][0][0] - segments[parameters.currentIndex][1][0]) + abs(segments[parameters.currentIndex][0][1] - segments[parameters.currentIndex][1][1])))
# lf1text2.setText(str(seg_orientation[parameters.currentIndex]))
lf1label2.setText (' Segment orientation: %s' % str(seg_orientation[parameters.currentIndex]))

#Left Frame top section
lframe1 = QFrame()
lframe1.setFrameShape(QFrame.StyledPanel)
lframe1.setStyleSheet("background-color: white;")
lf1title = QLabel('Current Path Length (microns): %s' % str(path_length))
lf1title = QLabel('Current waveguide length (microns): %s' % str(path_length))
parameters = QComboBox()
#add vertices as params
params = []
for each in range(len(segments)):
params.append("segment %s points: %s - %s" %(str(each), str(tuple(segments[each][0])), str(tuple(segments[each][1]))))
# params.append("segment %s points: %s - %s" %(str(each), str(tuple(segments[each][0])), str(tuple(segments[each][1]))))
params.append("segment %s, points: (%s, %s) - (%s, %s)" %(str(each), segments[each][0][0], segments[each][0][1], segments[each][1][0], segments[each][1][1]))



Expand All @@ -257,19 +260,23 @@ if is_waveguide == True:
parameters.setFixedWidth(400)
parameters.setStyleSheet("background-color: white;")
lf1label1 = QLabel('Segment length: ')
lf1label2 = QLabel('Segment Orientation: ')
lf1label2 = QLabel('Segment orientation: ')


lf1label3 = QLabel('New length (microns): ')
lf1text1 = QLineEdit()
lf1text1.setAccessibleName('lf1text1')
lf1label3 = QLabel('New target waveguide length (microns): ')

lf1title2 = QLabel('Chose the segment you wish to be moved:')

# lf1text1 = QLineEdit()
# lf1text1.setAccessibleName('lf1text1')
#lf1text1.setAccessibleDescription('within_wafer_width')
lf1text2 = QLineEdit()
lf1text2.setAccessibleName('lf1text2')
# lf1text2 = QLineEdit()
# lf1text2.setAccessibleName('lf1text2')
#lf1text2.setAccessibleDescription('within_wafer_thickness')
lf1text3 = QLineEdit()
lf1text3.setAccessibleName('lf1text3')
#lf1text3.setAccessibleDescription('within_wafer_correlation')


def button(self):
wdg.close() # don't want to change the layout while the GUI is open; leads to view problems.
Expand All @@ -285,7 +292,7 @@ if is_waveguide == True:
p1 = copy_pts[copy_pts.index(segments[index][0])]
p2 = copy_pts[copy_pts.index(segments[index][1])]
diff = float(lf1text3.text) - path_length
diff = diff/dbu
# diff = diff/dbu
prop = seg_propagation[index]
if(prop == "+x" or prop == "-x"):
print("moving x")
Expand All @@ -299,7 +306,7 @@ if is_waveguide == True:
# path_obj = cell.pcell_parameters_by_name()['path']
radius = cell.pcell_parameters()[1]

layout_waveguide_abs(topcell, LayerSi, points_mult(copy_pts,dbu), wg_width, radius)
layout_waveguide_abs(topcell, LayerSi, points_mult(copy_pts,1), wg_width, radius)
cell.delete()

# Clear the layout view selection, since we deleted some objects
Expand All @@ -318,12 +325,13 @@ if is_waveguide == True:
lf1form.addWidget(lf1title,0,0)
lf1form.addWidget(lf1label3, 1,0)
lf1form.addWidget(lf1text3, 1,1)
lf1form.addWidget(parameters,2,0)
lf1form.addWidget(lf1label1, 3,0)
lf1form.addWidget(lf1text1, 3,1)
lf1form.addWidget(lf1label2, 4,0)
lf1form.addWidget(lf1text2, 4,1)
lf1form.addWidget(ok, 5,1)
lf1form.addWidget(lf1title2,2,0)
lf1form.addWidget(parameters,3,0)
lf1form.addWidget(lf1label1, 4,0)
# lf1form.addWidget(lf1text1, 4,1)
lf1form.addWidget(lf1label2, 5,0)
# lf1form.addWidget(lf1text2, 5,1)
lf1form.addWidget(ok, 7,1)
lframe1.setLayout(lf1form)


Expand All @@ -339,13 +347,13 @@ if is_waveguide == True:
splitter1 = QSplitter(Qt.Horizontal)
textedit = QTextEdit()
splitter1.addWidget(leftsplitter)
splitter1.setSizes([400,400])
splitter1.setSizes([400,500])

#top frame
container = QWidget()
hbox.addWidget(splitter1)
objlist.append(lf1text1)
objlist.append(lf1text2)
# objlist.append(lf1text1)
# objlist.append(lf1text2)
objlist.append(lf1text3)

#filling gui
Expand Down

0 comments on commit 6998b60

Please sign in to comment.