def __init__(self): import os ui_file = pya.QFile( os.path.join(os.path.dirname(os.path.realpath(__file__)), "files", "waveguide_gui.ui")) ui_file.open(pya.QIODevice().ReadOnly) self.window = pya.QFormBuilder().load( ui_file, pya.Application.instance().main_window()) ui_file.close # *** lukasc comment: # waveguide types shouldn't be hardcoded, but rather read from WAVEGUIDES.xml. # I'm don't see the advantage of the waveguide_gui.ui approach, rather than coding the GUI generation within # Python like I did for the FDTD settings GUI in file: # Keybindings: GUI_FDTD_component_simulation #Button Bindings self.window.findChild('ok').clicked(self.ok) self.window.findChild('cancel').clicked(self.close) self.window.findChild('adiabatic').toggled(self.enable) self.window.findChild('bezier').setEnabled(False) self.window.findChild("configuration").currentIndexChanged( self.config_changed) self.loaded_technology = '' self.clicked = True
def test_gui_spoofs(): lygadgets.patch_environment() import pya # Borrowed from SiEPIC-Tools: https://github.com/lukasc-ubc/SiEPIC-Tools wdg = pya.QDialog(pya.Application.instance().main_window()) wdg.setAttribute(pya.Qt.WA_DeleteOnClose) ui_file = pya.QFile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "waveguidebuilder.ui")) ui_file.open(pya.QIODevice().ReadOnly) window = pya.QFormBuilder().load(ui_file, pya.Application.instance().main_window()) ui_file.close
def __init__(self): import os ui_file = pya.QFile(os.path.join(os.path.dirname( os.path.realpath(__file__)), "files", "monte_carlo_gui.ui")) ui_file.open(pya.QIODevice().ReadOnly) self.window = pya.QFormBuilder().load(ui_file, pya.Application.instance().main_window()) ui_file.close self.window.findChild('run').clicked(self.ok) self.window.findChild('cancel').clicked(self.close) self.window.findChild("technology").currentIndexChanged(self.tech_changed) self.window.findChild('num_wafers').minimum = 1 self.window.findChild('num_dies').minimum = 1 self.loaded_technology = '' self.clicked = True
def __init__(self): import os ui_file = pya.QFile(os.path.join(os.path.dirname( os.path.realpath(__file__)), "files", "waveguide_gui.ui")) ui_file.open(pya.QIODevice().ReadOnly) self.window = pya.QFormBuilder().load(ui_file, pya.Application.instance().main_window()) ui_file.close # Button Bindings self.window.findChild('ok').clicked(self.ok) self.window.findChild('cancel').clicked(self.close) self.window.findChild('adiabatic').toggled(self.enable) self.window.findChild('bezier').setEnabled(False) self.window.findChild("configuration").currentIndexChanged(self.config_changed) self.loaded_technology = '' self.clicked = True
def runInFastHenry(): # Load View app = pya.Application.instance() mw = app.main_window() lv = mw.current_view() ly = lv.active_cellview().layout() dbu = ly.dbu # Setup GUI ui_path = join("/Users/caleb/Development/klayout-macros/pymacros", "FastHenryGui.ui") ui_file = pya.QFile(ui_path) parent = pya.Application.instance().main_window() ui_file.open(pya.QIODevice.ReadOnly) form = pya.QFormBuilder().load(ui_file, parent) ui_file.close() # Bind Functions form.writeInputBtn.clicked(types.MethodType(writeInputFile, form)) form.runBtn.clicked(types.MethodType(callFastHenry, form)) # Load Shapes if lv is None: raise Exception("No view selected") selected_objects = lv.each_object_selected() i=0 for obj in selected_objects: if obj.shape.is_path() and not obj.is_cell_inst(): name = obj.shape.property('1') if name is None: name = str(i) i = i+1 print(name) form.traceComboBox.addItem(name) form.exec_()