def __init__(self):
		QToolBar.__init__(self)
		self.config_window=None
		self.electrical_mesh=None
		self.electrical_interfaces=None

		self.setToolButtonStyle( Qt.ToolButtonTextUnderIcon)
		self.setIconSize(QSize(42, 42))

		self.configwindow = QAction_lock("preferences-system", _("Configure"), self,"ribbon_config_config")
		self.configwindow.triggered.connect(self.callback_config_window)
		self.addAction(self.configwindow)

		self.dump = dump_io(self)
		global_object_register("ribbon_configure_dump_refresh",self.dump.refresh)
		self.addAction(self.dump)

		self.solar = QAction_lock("weather-few-clouds", _("Solar spectrum\ngenerator"), self,"solar_spectrum_tool")
		self.solar.clicked.connect(self.callback_solar)
		if is_gpvdm_next()==True:
			self.addAction(self.solar)


		self.mesh = QAction_lock("mesh", _("Electrical\nmesh"), self,"ribbon_config_mesh")
		self.mesh.triggered.connect(self.callback_edit_mesh)
		self.addAction(self.mesh)

		if is_gpvdm_next()==True:
			self.interfaces = QAction_lock("interfaces", _("Interfaces"), self,"ribbon_config_interfaces")
			self.interfaces.triggered.connect(self.callback_interfaces)
			self.addAction(self.interfaces)
示例#2
0
文件: gl.py 项目: xj361685640/gpvdm
        def initializeGL(self):
            self.load_data()
            try:
                glClearDepth(1.0)
                glDepthFunc(GL_LESS)
                glEnable(GL_DEPTH_TEST)
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
                glEnable(GL_BLEND)
                #glEnable(GL_PROGRAM_POINT_SIZE_EXT);
                glShadeModel(GL_SMOOTH)
                glViewport(0, 0, self.width(), self.height() + 100)
                glMatrixMode(GL_PROJECTION)
                glLoadIdentity()
                gluPerspective(
                    45.0,
                    float(self.width()) / float(self.height() + 100), 0.1,
                    1000.0)
                glMatrixMode(GL_MODELVIEW)
                #self.resizeEvent.connect(self.resize)

                self.failed = False
                global_object_register("gl_force_redraw", self.force_redraw)

            except:
                print("OpenGL failed to load falling back to 2D rendering.",
                      sys.exc_info()[0])
示例#3
0
    def init(self):
        self.cpus = multiprocessing.cpu_count()

        self.tab.setTabsClosable(True)
        self.tab.setMovable(True)
        self.tab.setTabBar(QHTabBar())
        self.tab.setTabPosition(QTabWidget.West)

        self.terminals = []
        self.process = []
        for i in range(0, self.cpus):
            term = output_box("local_cpu")

            proc = QProcess(self)
            proc.readyRead.connect(functools.partial(self.dataReady, i))
            self.process.append(proc)
            self.terminals.append(term)
            self.tab.addTab(term, _("CPU") + " " + str(i))

        self.cluster_output = output_box("cluster_node")
        self.tab.addTab(self.cluster_output, _("Cluster"))

        self.jview = jobs_view()
        #self.jview.load_data(self.myserver.cluster_jobs)
        self.tab.addTab(self.jview, "Jobs list")

        if enable_betafeatures() == True:
            self.cluster = hpc_class()
            self.tab.addTab(self.cluster, _("Nodes"))
            global_object_register("cluster_tab", self.cluster)

        self.my_server.new_message.connect(self.data_from_cluster)
示例#4
0
	def __init__(self):
		QWidget.__init__(self)
		css_apply(self,"tab_default.css")
		self.terminal=None
		self.update_display_function=None
		self.currentChanged.connect(self.changed_click)
		global_object_register("notebook_goto_page",self.goto_page)
示例#5
0
    def __init__(self):
        QToolBar.__init__(self)
        self.doping_window = None
        self.cost_window = None
        self.parasitic = None
        self.contacts_window = None
        self.parasitic_window = None
        self.layer_editor = None
        self.dim_editor = None
        self.electrical_editor = None
        self.emission_editor = None

        self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        self.setOrientation(Qt.Vertical)
        self.setIconSize(QSize(42, 42))

        self.tb_layer_editor = QAction_lock("layers", _("Layer\neditor"), self,
                                            "ribbon_device_layers")
        self.tb_layer_editor.clicked.connect(self.callback_layer_editor)
        self.addAction(self.tb_layer_editor)
        global_object_register("show_layer_editor", self.callback_layer_editor)

        self.contacts = QAction_lock("contact", _("Contacts"), self,
                                     "ribbon_device_contacts")
        self.contacts.clicked.connect(self.callback_contacts)
        self.addAction(self.contacts)

        self.doping = QAction_lock("doping", _("Doping/\nIons"), self,
                                   "ribbon_device_doping")
        self.doping.clicked.connect(self.callback_doping)
        self.addAction(self.doping)

        self.parasitic = QAction_lock("parasitic", _("Parasitic\n components"),
                                      self, "ribbon_device_parasitic")
        self.parasitic.clicked.connect(self.callback_parasitic)
        self.addAction(self.parasitic)

        self.tb_electrical_editor = QAction_lock("electrical",
                                                 _("Electrical\nparameters"),
                                                 self,
                                                 "ribbon_device_electrical")
        self.tb_electrical_editor.clicked.connect(
            self.callback_electrical_editor)
        self.addAction(self.tb_electrical_editor)

        self.tb_emission_editor = QAction_lock("emission",
                                               _("Emission\nparameters"), self,
                                               "ribbon_device_emission")
        self.tb_emission_editor.clicked.connect(self.callback_emission_editor)
        self.addAction(self.tb_emission_editor)

        self.tb_dimension_editor = QAction_lock("dimensions", _("xz-size"),
                                                self, "ribbon_device_dim")
        self.tb_dimension_editor.clicked.connect(
            self.callback_dimension_editor)
        self.addAction(self.tb_dimension_editor)

        get_watch().add_call_back("diagram.inp", self.callback_circuit_diagram)
        self.callback_circuit_diagram()
示例#6
0
	def init(self):
		self.notebook = gtk.Notebook()
		print "Welcome"
		read_page=False
		self.pack_start(self.notebook, True, True, 0)
		self.notebook.set_tab_pos(gtk.POS_LEFT)
		self.notebook.show()
		global_object_register("dos-update",self.update)
示例#7
0
	def __init__(self):
		QToolBar.__init__(self)
		self.actions=[]
		self.order=["jv","jv_perovskite","|","sun_voc","suns_jsc","equilibrium","|","TPC","TPV","|","IS", "IMPS","|", "CELIV","Photo"]
		self.dont_show=["photon_extraction"]
		self.myserver=server_get()

		self.setToolButtonStyle( Qt.ToolButtonTextUnderIcon)
		self.setIconSize(QSize(42, 42))
		global_object_register("ribbon_sim_mode_update",self.update)
示例#8
0
	def callback_optics_sim(self, widget, data=None):
		help_window().help_set_help(["optics.png",_("<big><b>The optical simulation window</b></big><br>Use this window to perform optical simulations.  Click on the play button to run a simulation."),"media-playback-start",_("Click on the play button to run an optical simulation.  The results will be displayed in the tabs to the right."),"youtube",_("<big><b><a href=\"https://www.youtube.com/watch?v=A_3meKTBuWk\">Tutorial video</b></big><br>Designing optical filters and reflective coatings.")])


		if self.optics_window==False:
			self.optics_window=class_optical()
			#self.notebook.changed.connect(self.optics_window.update)

		if self.optics_window.isVisible()==True:
			self.optics_window.hide()
		else:
			global_object_register("optics_force_redraw",self.optics_window.force_redraw)
			self.optics_window.show()
示例#9
0
    def __init__(self):
        QWidget.__init__(self)
        self.main_vbox = QVBoxLayout()
        self.notebook = QTabWidget()

        self.main_vbox.addWidget(self.notebook)
        self.setLayout(self.main_vbox)

        self.notebook.setTabsClosable(True)
        self.notebook.setMovable(True)
        self.notebook.setTabBar(QHTabBar())
        self.notebook.setTabPosition(QTabWidget.West)

        global_object_register("dos_update", self.update)
示例#10
0
	def __init__(self):
		QWidget.__init__(self)
		self.main_vbox = QVBoxLayout()
		self.notebook = QTabWidget()

		self.main_vbox.addWidget(self.notebook)
		self.setLayout(self.main_vbox)

		self.notebook.setTabsClosable(True)
		self.notebook.setMovable(True)
		bar=QHTabBar()
		bar.setStyleSheet("QTabBar::tab { height: 35px; width: 200px; }")
		self.notebook.setTabBar(bar)
		self.notebook.setTabPosition(QTabWidget.West)

		global_object_register("pl_update",self.update)
示例#11
0
	def load(self):
		self.clear()
		self.clean_menu()
		self.last_page=0

		#self.setTabsClosable(True)
		self.setMovable(True)
		if (os.path.isfile(os.path.join(get_sim_path(),"sim.gpvdm"))==True):
			self.finished_loading=False
			#self.progress.init()
			#self.progress.show()
			#self.progress.start()
			#self.progress.set_text("Loading..")
			#process_events()


#			dos_files=inp_get_token_value("device_epitaxy.inp", "#layers")

			widget=tab_main()
			self.addTab(widget,_("Device structure"))

			self.update_display_function=widget.update


			self.terminal=tab_terminal()
			self.terminal.init()
			self.addTab(self.terminal,_("Terminal"))
			self.terminal.run(os.getcwd(),get_exe_command()+" --version "+get_exe_args())
			global_object_register("terminal",self.terminal)

			widget=tab_view()
			self.addTab(widget,_("Output"))

			#self.add_info_page()

			return True


			self.finished_loading=True
			#self.progress.stop()
			#self.progress.set_fraction(0.0)
			self.goto_page(_("Device structure"))

		else:
			self.add_info_page()
			self.goto_page(_("Information"))
			return False
示例#12
0
    def __init__(self):
        QToolBar.__init__(self)
        self.doping_window = None
        self.cost_window = None
        self.parasitic = None
        self.contacts_window = None
        self.parasitic_window = None
        self.layer_editor = None
        self.dim_editor = None
        self.electrical_editor = None

        self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        self.setOrientation(Qt.Vertical)
        self.setIconSize(QSize(42, 42))

        self.tb_layer_editor = QAction(icon_get("layers"), _("Layer\neditor"),
                                       self)
        self.tb_layer_editor.triggered.connect(self.callback_layer_editor)
        self.addAction(self.tb_layer_editor)
        global_object_register("show_layer_editor", self.callback_layer_editor)

        self.contacts = QAction(icon_get("contact"), _("Contacts"), self)
        self.contacts.triggered.connect(self.callback_contacts)
        self.addAction(self.contacts)

        self.doping = QAction(icon_get("doping"), _("Doping"), self)
        self.doping.triggered.connect(self.callback_doping)
        self.addAction(self.doping)

        self.parasitic = QAction(icon_get("parasitic"),
                                 _("Parasitic\n components"), self)
        self.parasitic.triggered.connect(self.callback_parasitic)
        self.addAction(self.parasitic)

        self.tb_electrical_editor = QAction(icon_get("electrical"),
                                            _("Electrical\nparameters"), self)
        self.tb_electrical_editor.triggered.connect(
            self.callback_electrical_editor)
        self.addAction(self.tb_electrical_editor)

        self.tb_dimension_editor = QAction(icon_get("dimensions"),
                                           _("xz-size"), self)
        self.tb_dimension_editor.triggered.connect(
            self.callback_dimension_editor)
        self.addAction(self.tb_dimension_editor)
示例#13
0
    def __init__(self):
        QWidget.__init__(self)
        self.setMinimumSize(1000, 600)

        self.main_vbox = QVBoxLayout()

        self.setWindowIcon(icon_get("preferences-system"))

        self.setWindowTitle(
            _("Electrical parameter editor") + " (https://www.gpvdm.com)")

        toolbar = QToolBar()
        toolbar.setIconSize(QSize(48, 48))

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        toolbar.addWidget(spacer)

        self.help = QAction(icon_get("help"), _("Help"), self)
        self.help.setStatusTip(_("Help"))
        self.help.triggered.connect(self.callback_help)
        toolbar.addAction(self.help)

        self.main_vbox.addWidget(toolbar)

        self.notebook = QTabWidget()

        css_apply(self, "tab_default.css")

        self.main_vbox.addWidget(self.notebook)
        self.setLayout(self.main_vbox)

        #self.notebook.setTabsClosable(True)
        #self.notebook.setMovable(True)
        #self.notebook.setTabBar(QHTabBar())
        #self.notebook.setTabPosition(QTabWidget.West)

        global_object_register("dos_update", self.update)
        self.status_bar = QStatusBar()
        self.notebook.currentChanged.connect(self.changed_click)

        self.main_vbox.addWidget(self.status_bar)
        self.update()
示例#14
0
    def callback_optics_sim(self, widget, data=None):
        help_window().help_set_help([
            "optics.png",
            _("<big><b>The optical simulation window</b></big><br>Use this window to perform optical simulations.  Click on the play button to run a simulation."
              ), "media-playback-start",
            _("Click on the play button to run an optical simulation.  The results will be displayed in the tabs to the right."
              )
        ])

        if self.optics_window == False:
            self.optics_window = class_optical()
            #self.notebook.changed.connect(self.optics_window.update)

        if self.optics_window.isVisible() == True:
            self.optics_window.hide()
        else:
            global_object_register("optics_force_redraw",
                                   self.optics_window.force_redraw)
            self.optics_window.show()
示例#15
0
    def __init__(self):
        QToolBar.__init__(self)
        self.config_window = None
        self.electrical_mesh = None
        self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        self.setIconSize(QSize(42, 42))

        self.configwindow = QAction(icon_get("preferences-system"),
                                    _("Configure"), self)
        self.configwindow.triggered.connect(self.callback_config_window)
        self.addAction(self.configwindow)

        self.dump = dump_io(self)
        global_object_register("ribbon_configure_dump_refresh",
                               self.dump.refresh)
        self.addAction(self.dump)

        self.mesh = QAction(icon_get("mesh"), _("Electrical\nmesh"), self)
        self.mesh.triggered.connect(self.callback_edit_mesh)
        self.addAction(self.mesh)
示例#16
0
    def __init__(self):
        QWidget.__init__(self)
        self.main_vbox = QVBoxLayout()

        self.setWindowIcon(icon_get("preferences-system"))

        self.setWindowTitle(
            _("Luminescence editor") + " (https://www.gpvdm.com)")

        toolbar = QToolBar()
        toolbar.setIconSize(QSize(48, 48))

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        toolbar.addWidget(spacer)

        self.help = QAction(icon_get("help"), _("Help"), self)
        self.help.setStatusTip(_("Help"))
        self.help.triggered.connect(self.callback_help)
        toolbar.addAction(self.help)

        self.main_vbox.addWidget(toolbar)

        self.notebook = QTabWidget()

        css_apply(self, "tab_default.css")

        self.main_vbox.addWidget(self.notebook)
        self.setLayout(self.main_vbox)

        self.notebook.setTabsClosable(True)
        self.notebook.setMovable(True)
        bar = QHTabBar()
        bar.setStyleSheet("QTabBar::tab { height: 35px; width: 200px; }")
        self.notebook.setTabBar(bar)
        self.notebook.setTabPosition(QTabWidget.West)

        global_object_register("pl_update", self.update)

        self.update()
示例#17
0
    def load(self):
        self.clear()
        self.last_page = 0

        #self.setTabsClosable(True)
        self.setMovable(True)
        if (os.path.isfile(os.path.join(get_sim_path(), "sim.gpvdm")) == True):

            self.tab_main = tab_main()
            self.addTab(self.tab_main, _("Device structure"))

            mesh = get_mesh()
            if mesh.y.circuit_model == True:  # or mesh.x.tot_points!=1 or mesh.z.tot_points!=1:
                self.display_mesh = display_mesh()

                if mesh.y.circuit_model == True:
                    self.addTab(self.display_mesh, _("Circuit diagram"))
                else:
                    self.addTab(self.display_mesh, _("Electrical mesh"))

            self.update_display_function = self.tab_main.update
            #self.tab_main.three_d.display.force_redraw()

            self.terminal = tab_terminal()
            self.terminal.init()
            self.addTab(self.terminal, _("Terminal"))
            self.terminal.run(
                os.getcwd(),
                get_exe_command() + " --version2 " + get_exe_args())
            global_object_register("terminal", self.terminal)

            widget = tab_view()
            self.addTab(widget, _("Output"))
            self.add_docs_page()
            self.state_loaded = True

        else:
            self.add_info_page()
            self.goto_page(_("Information"))
            self.state_loaded = False
示例#18
0
    def __init__(self):
        QWidgetSavePos.__init__(self, "emesh")

        self.setMinimumSize(1200, 600)
        self.setWindowIcon(icon_get("mesh"))

        self.setWindowTitle(
            _("Electrical Mesh Editor") + " - (https://www.gpvdm.com)")

        self.main_vbox = QVBoxLayout()

        toolbar = QToolBar()
        toolbar.setIconSize(QSize(48, 48))

        self.one_d = QAction(icon_get("1d"), _("1D simulation"), self)
        self.one_d.triggered.connect(self.callback_dim_1d)
        toolbar.addAction(self.one_d)

        self.two_d = QAction(icon_get("2d"), _("2D simulation"), self)
        self.two_d.triggered.connect(self.callback_dim_2d)
        toolbar.addAction(self.two_d)

        self.three_d = QAction(icon_get("3d"), _("3D simulation"), self)
        self.three_d.triggered.connect(self.callback_dim_3d)
        toolbar.addAction(self.three_d)

        configure = QAction(icon_get("preferences-system", size=32),
                            _("Configure mesh"), self)
        configure.triggered.connect(self.on_configure_click)
        toolbar.addAction(configure)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)

        self.undo = QAction(icon_get("help"), _("Help"), self)
        self.undo.setStatusTip(_("Close"))
        self.undo.triggered.connect(self.callback_help)
        toolbar.addAction(self.undo)

        self.main_vbox.addWidget(toolbar)

        widget = QWidget()
        mesh_hbox = QHBoxLayout()
        widget.setLayout(mesh_hbox)

        self.emesh_editor_x = electrical_mesh_editor("x")
        self.emesh_editor_x.changed.connect(self.emit_now)

        self.emesh_editor_y = electrical_mesh_editor("y")
        self.emesh_editor_y.changed.connect(self.emit_now)

        self.emesh_editor_z = electrical_mesh_editor("z")
        self.emesh_editor_z.changed.connect(self.emit_now)

        mesh_hbox.addWidget(self.emesh_editor_x)
        mesh_hbox.addWidget(self.emesh_editor_y)
        mesh_hbox.addWidget(self.emesh_editor_z)

        self.main_vbox.addWidget(widget)

        self.update_dim()

        self.setLayout(self.main_vbox)
        self.mesh_config = None
        global_object_register("mesh_update", self.update)
示例#19
0
    def __init__(self):
        QWidget.__init__(self)
        self.complex_display = False

        self.hbox = QVBoxLayout()

        mesh = get_mesh()
        if mesh.y.circuit_model == True and mesh.x.tot_points == 1 and mesh.z.tot_points == 1:
            self.display = circuit_editor()

            epi = get_epi()
            pos = 3
            self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3, "bat")
            pos = pos + 1

            for l in epi.layers:
                f = inp()
                f.load(
                    os.path.join(get_sim_path(), l.shape_electrical + ".inp"))
                component = f.get_token("#electrical_component")
                if component == "resistance":
                    self.display.ersatzschaltbild.add_object(
                        pos, 3, pos + 1, 3, "resistor")
                if component == "diode":
                    self.display.ersatzschaltbild.add_object(
                        pos, 3, pos + 1, 3, "diode")

                pos = pos + 1
            self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3,
                                                     "ground")
            self.display.ersatzschaltbild.objects_push()

            if inp().isfile(os.path.join(get_sim_path(),
                                         "diagram.inp")) == True:
                self.display.ersatzschaltbild.load()
        else:
            toolbar = QToolBar()
            toolbar.setIconSize(QSize(42, 42))

            spacer = QWidget()
            spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            toolbar.addWidget(spacer)

            self.xy = QAction(icon_get("xy"), _("xy"), self)
            self.xy.triggered.connect(self.callback_xy)
            toolbar.addAction(self.xy)

            self.yz = QAction(icon_get("yz"), _("yz"), self)
            self.yz.triggered.connect(self.callback_yz)
            toolbar.addAction(self.yz)

            self.xz = QAction(icon_get("xz"), _("xz"), self)
            self.xz.triggered.connect(self.callback_xz)
            toolbar.addAction(self.xz)

            self.tb_rotate = QAction(icon_get("rotate.png"), _("Rotate"), self)
            self.tb_rotate.triggered.connect(self.tb_rotate_click)
            toolbar.addAction(self.tb_rotate)
            self.tb_rotate.setEnabled(True)

            self.hbox.addWidget(toolbar)

            self.display = glWidget(self)
            self.display.draw_electrical_mesh = True
            self.display.view.draw_device = False
            self.display.enable_cordinates = False
            self.display.view.render_photons = False
            #self.display.force_redraw()
            global_object_register("display_mesh_recalculate",
                                   self.recalculate)

        self.hbox.addWidget(self.display)

        self.setLayout(self.hbox)
示例#20
0
        def initializeGL(self):
            self.load_data()
            #try:
            glClearDepth(1.0)
            glDepthFunc(GL_LESS)
            glEnable(GL_DEPTH_TEST)
            glBlendFunc(GL_SRC_ALPHA, GL_ONE)
            #GL_ONE_MINUS_SRC_ALPHA
            glEnable(GL_BLEND)
            glShadeModel(GL_SMOOTH)

            #lightZeroPosition = [0, 0, -10, 1.0]
            #lightZeroColor = [1.0, 1.0, 1.0, 1.0]
            #glLightfv(GL_LIGHT1, GL_POSITION, lightZeroPosition)
            #glLightfv(GL_LIGHT1,  GL_DIFFUSE, lightZeroColor)
            #glLightf(GL_LIGHT1, GL_CONSTANT_ATTENUATION, 0.1)
            #glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 0.05)
            #glEnable(GL_LIGHT1)

            #lightZeroPosition = [10, 10, 0, 1.0]
            #lightZeroColor = [1.0, 1.0, 1.0, 1.0]
            #glLightfv(GL_LIGHT2, GL_POSITION, lightZeroPosition)
            #glLightfv(GL_LIGHT2,  GL_DIFFUSE, lightZeroColor)
            #glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 0.1)
            #glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0.05)
            #glEnable(GL_LIGHT2)

            #GL_DIFFUSE

            #glEnable(GL_FOG);
            #fogColor = [0.5, 0.5, 0.5, 1.0];

            #glFogi (GL_FOG_MODE, GL_EXP);
            #glFogfv (GL_FOG_COLOR, fogColor);
            #glFogf (GL_FOG_DENSITY, 0.35);
            #glHint (GL_FOG_HINT, GL_DONT_CARE);
            #glFogf (GL_FOG_START, 1.0);
            #glFogf (GL_FOG_END, 5.0);
            #self.tex = self.read_texture('/home/rod/images/image.jpg')
            glViewport(0, 0, self.width(), self.height() + 100)
            glMatrixMode(GL_PROJECTION)
            glLoadIdentity()
            #glScalef(1.0, 1.0, -1.0)
            gluPerspective(45.0,
                           float(self.width()) / float(self.height() + 100),
                           0.1, 1000.0)
            glMatrixMode(GL_MODELVIEW)
            glEnable(GL_POLYGON_SMOOTH)
            #glEnable(GL_MULTISAMPLE)
            #self.resizeEvent.connect(self.resize)

            if self.lit == True:
                for l in self.lights:
                    glEnable(GL_LIGHTING)
                    lightZeroColor = [1.0, 1.0, 1.0, 1.0]
                    #print(l.number,GL_LIGHT1)
                    glLightfv(l.number, GL_POSITION,
                              [l.xyz[0], -l.xyz[1], -l.xyz[2]])
                    glLightfv(l.number, GL_DIFFUSE, lightZeroColor)
                    #glLightfv(l.number, GL_SPOT_DIRECTION, [ 1,1,1]);
                    glLightf(l.number, GL_CONSTANT_ATTENUATION, 0.1)
                    glLightf(l.number, GL_LINEAR_ATTENUATION, 0.05)
                    glEnable(l.number)

            self.failed = False
            global_object_register("gl_force_redraw", self.force_redraw)
            get_watch().add_call_back("light.inp", self.force_redraw)
            get_epi().add_callback(self.force_redraw)
示例#21
0
    def __init__(self):
        QWidget.__init__(self)
        self.complex_display = False

        self.hbox = QVBoxLayout()
        self.gl_cmp = gl_cmp(os.path.join(get_sim_path(), "snapshots"))

        toolbar = QToolBar()
        toolbar.setIconSize(QSize(42, 42))

        #self.tb_layer_editor = QAction(icon_get("layers"), _("Layer\neditor"), self)
        #self.tb_layer_editor.triggered.connect(self.callback_layer_editor)
        #toolbar.addAction(self.tb_layer_editor)

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        toolbar.addWidget(spacer)

        self.xy = QAction(icon_get("xy"), _("xy"), self)
        self.xy.triggered.connect(self.callback_xy)
        toolbar.addAction(self.xy)

        self.yz = QAction(icon_get("yz"), _("yz"), self)
        self.yz.triggered.connect(self.callback_yz)
        toolbar.addAction(self.yz)

        self.xz = QAction(icon_get("xz"), _("xz"), self)
        self.xz.triggered.connect(self.callback_xz)
        toolbar.addAction(self.xz)

        self.tb_rotate = QAction(icon_get("rotate.png"), _("Rotate"), self)
        self.tb_rotate.triggered.connect(self.tb_rotate_click)
        toolbar.addAction(self.tb_rotate)
        self.tb_rotate.setEnabled(True)

        self.tb_config = QAction(icon_get("preferences-system"),
                                 _("Configuration"), self)
        self.tb_config.triggered.connect(self.callback_configure)
        toolbar.addAction(self.tb_config)

        self.fx_box = fx_selector()
        self.fx_box.file_name_set_start("light_ray_")
        self.fx_box.file_name_set_end(".dat")
        self.fx_box.update()

        self.fx_box.cb.currentIndexChanged.connect(self.fx_box_changed)
        toolbar.addWidget(self.fx_box)

        self.hbox.addWidget(toolbar)

        enable_3d = inp_get_token_value(
            os.path.join(get_sim_path(), "config.inp"),
            "#gui_config_3d_enabled")
        if enable_3d == None:
            enable_3d = "True"
        enable_3d = str2bool(enable_3d)

        if enable_3d == True:
            self.display = glWidget(self)
            self.update_ray_file()

            self.hbox.addWidget(self.display)

            #self.display.setMinimumSize(800, 600)

            self.timer = QTimer()
            self.timer.setSingleShot(True)
            self.timer.timeout.connect(self.timer_update)
            self.timer.start(5000)
        else:
            self.add_fallback()

        self.setLayout(self.hbox)
        global_object_register("display_recalculate", self.recalculate)
        global_object_register("display_set_selected_layer",
                               self.set_selected_layer)
示例#22
0
	def init(self):
		self.win_list=windows()
		self.win_list.load()
		self.win_list.set_window(self,"experiment_window")
		global_object_register("experiment_graph_update",self.update)
		print "constructur"

		self.tooltips = gtk.Tooltips()

		self.set_border_width(2)
		self.set_title(_("Time domain experiment window - opvdm"))

		self.status_bar = gtk.Statusbar()      
		self.status_bar.show()
		self.context_id = self.status_bar.get_context_id("Statusbar example")

		box=gtk.HBox()
		box.add(self.status_bar)
		box.set_child_packing(self.status_bar, True, True, 0, 0)
		box.show()


		self.menu_items = (
		    ( _("/_File"),         None,         None, 0, "<Branch>" ),
		    ( _("/File/Close"),     None, self.callback_close, 0, None ),
		    ( _("/Experiments/_New"),     None, self.callback_add_page, 0, "<StockItem>", "gtk-new" ),
		    ( _("/Experiments/_Delete experiment"),     None, self.callback_delete_page, 0, "<StockItem>", "gtk-delete" ),
		    ( _("/Experiments/_Rename experiment"),     None, self.callback_rename_page, 0, "<StockItem>", "gtk-edit" ),
		    ( _("/Experiments/_Clone experiment"),     None, self.callback_copy_page, 0, "<StockItem>", "gtk-copy" ),
		    ( _("/_Help"),         None,         None, 0, "<LastBranch>" ),
		    ( _("/_Help/Help"),   None,         self.callback_help, 0, None ),
		    ( _("/_Help/About"),   None,         about_dialog_show, 0, "<StockItem>", "gtk-about" ),
		    )


		main_vbox = gtk.VBox(False, 3)

		menubar = self.get_main_menu(self)
		main_vbox.pack_start(menubar, False, False, 0)
		menubar.show()

		toolbar = gtk.Toolbar()
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_size_request(-1, 50)
		pos=0

		tb_new_scan = gtk.ToolButton(gtk.STOCK_NEW)
		tb_new_scan.connect("clicked", self.callback_add_page)
		self.tooltips.set_tip(tb_new_scan, _("New experiment"))

		toolbar.insert(tb_new_scan, pos)
		pos=pos+1

		delete = gtk.ToolButton(gtk.STOCK_DELETE)
		delete.connect("clicked", self.callback_delete_page,None)
		self.tooltips.set_tip(delete, _("Delete experiment"))
		toolbar.insert(delete, pos)
		pos=pos+1

		copy = gtk.ToolButton(gtk.STOCK_COPY)
		copy.connect("clicked", self.callback_copy_page,None)
		self.tooltips.set_tip(copy, _("Clone experiment"))
		toolbar.insert(copy, pos)
		pos=pos+1


		rename = gtk.ToolButton(gtk.STOCK_EDIT)
		rename.connect("clicked", self.callback_rename_page,None)
		self.tooltips.set_tip(rename, _("Rename experiment"))
		toolbar.insert(rename, pos)
		pos=pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(True)
		sep.set_expand(False)
		toolbar.insert(sep, pos)
		pos=pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(False)
		sep.set_expand(True)
		toolbar.insert(sep, pos)
		pos=pos+1

		tb_help = gtk.ToolButton(gtk.STOCK_HELP)
		tb_help.connect("clicked", self.callback_help)
		self.tooltips.set_tip(tb_help, "Help")
		toolbar.insert(tb_help, pos)
		pos=pos+1


		toolbar.show_all()
		main_vbox.pack_start(toolbar, False, False, 0)

		main_vbox.set_border_width(1)
		self.add(main_vbox)
		main_vbox.show()
	

		self.notebook = gtk.Notebook()
		self.notebook.show()
		self.notebook.set_tab_pos(gtk.POS_LEFT)

		self.load_tabs()
		main_vbox.pack_start(self.notebook, True, True, 0)
		main_vbox.pack_start(box, False, False, 0)

		self.connect("delete-event", self.callback_close)
		self.notebook.connect("switch-page",self.switch_page)
		self.set_icon_from_file(os.path.join(get_image_file_path(),"image.jpg"))

		self.hide()
示例#23
0
 def __init__(self):
     QWidget.__init__(self)
     gl_base_widget.__init__(self)
     #self.setMinimumSize(600, 500)
     self.epi = get_epi()
     global_object_register("gl_force_redraw", self.force_redraw)
示例#24
0
	def make_tool_box1(self):
		pos=0
		toolbar = gtk.Toolbar()
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_size_request(900, 50)
		toolbar.show()

		if debug_mode()==True:
			image = gtk.Image()
	   		image.set_from_file(os.path.join(get_image_file_path(),"qe.png"))
			self.qe_button = gtk.ToolButton(image)
			self.tooltips.set_tip(self.qe_button, _("Quantum efficiency"))
			self.qe_button.connect("clicked", self.callback_qe_window)
			toolbar.insert(self.qe_button, pos)
			self.qe_button.show_all()
			pos=pos+1

		self.sim_mode=tb_item_sim_mode()
		self.sim_mode.init()
		global_object_register("tb_item_sim_mode_update",self.sim_mode.update)
		toolbar.insert(self.sim_mode, pos)
		pos=pos+1

		self.ti_light=tb_item_sun()
		self.light=self.ti_light.light

		toolbar.insert(self.ti_light, pos)
		pos=pos+1

		ti_progress = gtk.ToolItem()
		hbox = gtk.HBox(False, 2)

		sep = gtk.SeparatorToolItem()

		sep.set_draw(False)
		sep.set_expand(True)
		sep.show_all()

		toolbar.insert(sep, pos)
		pos=pos+1

		self.spin=gtk.Spinner()
		self.spin.set_size_request(32, 32)
		self.spin.show()
		self.spin.stop()


		gap=gtk.Label(" ")
		hbox.add(gap)
		hbox.add(self.spin)	
		hbox.set_child_packing(self.spin, False, False, 0, 0)


		gap.show()
		hbox.show()

		ti_progress.add(hbox)

		toolbar.insert(ti_progress, pos)
		pos=pos+1
		ti_progress.show()
		return toolbar
示例#25
0
 def __init__(self):
     QWidget.__init__(self)
     #self.setMinimumSize(600, 500)
     self.suns = 1
     global_object_register("gl_force_redraw", self.force_redraw)