Hallo,

 

ich habe folgendes Problem, welches vielleicht mehr am event- System des GUI- Toolkits liegt als an Python.

Ich benutze wxPython für meine Anwendung und wie ich festgestellt habe ist es offensichtlich nicht möglich im

Eventhandler weitere Funktionen aufzurufen?

Wie würde man das Problem am sinnvollsten lösen?

 

Bevor wieder Beschwerden wegen der Python Coding Richtline kommen, die hab ich hier noch nicht berücksichtigt, gelobe aber Besserung.

 

Hier der Code:

 

    def OnSelDevice(self, event):

        selDeviceArgsList = []

        try:

            if self.gpib_bus == 0:

                self.gpib_bus = GPIB_Bus()

 

            device = SelDeviceDialog(None, -1, "Device Select Dialog",

                                     self.gpib_bus.devices,

                                     self.checkedDevices)

            device.ShowModal()

            self.checkedDevices = device.deviceListBox.Checked

            if len(self.checkedDevices) > 0:

                for i in device.deviceListBox.CheckedStrings:

                    selDevArgs = i.split(" : ")

                    selDeviceArgsList.append(selDevArgs)

                status = update_intruments(selDeviceArgsList)

            if len(self.instruments):

                self.menu_item_testsettings.Enable(True)

 

        except:

            noBusDlg = wx.MessageDialog(None, 'No GPIB Device available. Remote measurement is not possible',

                                        'Information', wx.CANCEL | wx.ICON_INFORMATION, pos=wx.DefaultPosition)

            noBusDlg.ShowModal()

           noBusDlg.Destroy()

        device.Destroy()

 

    def update_intruments(self, clicked_devices):

        clicked_serials = []

        for i in clicked_devices:

            clicked_serials.append(clicked_devices[1])

        for  i in self.used_gpib_serials:

            if i not in clicked_serials:

                #wurde ein bereits verwendetes Gerät abgewählt?

                removeInstrument(i)

        for i in clicked_serials:

            if i not in self.used_gpib_serials:

                #wurde ein noch nicht verwendetes Gerät angewählt?

                success = addInstrument(i)

        return success

 

    def addInstrument(self, instrumentID):

        modell_nummer = self.gpib_bus.get_model(instrumentID)

        if modell_nummer == "34405A":

            self.instruments.append(Agilent.Agilent34405A(self.gpib_bus, instrumentID))

            last_added = len(self.instruments)-1

            self.used_gpib_serials.append(self.instruments[last_added].serial_nr)

            retval = True

        else:

            retval = False

        return retval

 

 

Schon jetzt recht herzlichen Dank

 

Frank

--

--

 P   Bevor Sie diese E-Mail ausdrucken, überlegen Sie bitte, ob dies wirklich erforderlich ist. Please think before you print.

--

WIKA Alexander Wiegand SE & Co. KG

Alexander-Wiegand-Straße 30 - 63911 Klingenberg - Germany

Kommanditgesellschaft: Sitz Klingenberg - Amtsgericht Aschaffenburg HRA 1819

Komplementärin: WIKA Verwaltungs SE & Co. KG - Sitz Klingenberg -

Amtsgericht Aschaffenburg HRA 4685

Komplementärin: WIKA International SE - Sitz Klingenberg -

Amtsgericht Aschaffenburg HRB 10505

Vorstand: Alexander Wiegand

Vorsitzender des Aufsichtsrats: Dr. Max Egli

Telefon: (09372) 132-0

Internet: www.wika.com

--

The information contained in this E-Mail and any attached files are strictly confidential and may be subject to legal privilege. If you are not the intended recipient, his representative or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any dissemination, copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein. If you have received this E-Mail in error, please notify us immediately by E-Mail or telephone and delete this message and all its attachments subsequently. All reasonable precautions have been taken to ensure no viruses are present in this E-Mail.