×
INDI Library v1.8.1 Released (09 Sep 2019)

Monthly maintenance release INDI v1.8.1

Using PyIndi client with a simple GUI

1 year 7 months ago
Lagreeni
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Using PyIndi client with a simple GUI #24928
Hi,
I've been having a lot of issues creating a client for multiple devices, a filter wheel and camera. When following the PyIndi client tutorials, I'm not able to change a device property by choice. I'm now trying to control the devices through a simple button GUI to provide an interface to change a set of properties by choice. For example, I have one simple GUI with 2 buttons, one to change the filter wheel to slot 1 and the other to change it to slot 2. Going into this, I thought that it would be as simple as running a basic client in the background and import another client for the filter wheel where I could call the function newProperty through my GUI. This is the code I have for changing the filter slot (bits of it):

#######################################################
class IndiClient(PyIndi.BaseClient):
dwheel = None
def __init__(self):
super(IndiClient, self).__init__()
def newDevice(self, d):
pass #connecting the filter wheel via a basic client
def newProperty(self, p):
if p.getName() == "FILTER_SLOT":
self.nd18()
......
def nd18(self):
slot=self.dwheel.getNumber("FILTER_SLOT")
slot[0].value=1
self.sendNewNumber(slot)

##############################################################3
I imported the IndiClient class from the script to my GUI and am trying to call newProperty, but I hit an issue with the arguments. I don't know how to call the functions ie: newProperty(self, p) because of the "p", property, parameter. I'm not very well versed with Python, so I imagine I'm missing something very obvious, but its doing a dang good job of eluding me. I'm not even sure if just calling the function newProperty or even nd18 would work.

tltr: How do you connect a GUI to a PyIndi client? Can you call one of the PyIndi functions such as newProperty(self, p) and if so, how?

Please Log in or Create an account to join the conversation.

1 year 7 months ago
oleg
Moderator
Moderator
Posts: 320
Karma: 5
More
Using PyIndi client with a simple GUI #24929
Do you know about other INDI clients?
indilib.org/about/clients.html

You can try my open project Astronomy Linux

Please Log in or Create an account to join the conversation.

1 year 7 months ago
Lagreeni
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Using PyIndi client with a simple GUI #24932
I do, but I need a customized client. The other INDI clients have a lot of what I don't need. I'm just looking to make a simple interface.

Please Log in or Create an account to join the conversation.

1 year 7 months ago
oleg
Moderator
Moderator
Posts: 320
Karma: 5
More
Using PyIndi client with a simple GUI #24933

Lagreeni wrote: I do, but I need a customized client. The other INDI clients have a lot of what I don't need. I'm just looking to make a simple interface.

DCD-0.13 device control device
INDI starter

You can try my open project Astronomy Linux

Please Log in or Create an account to join the conversation.

1 year 7 months ago
geehalel
Gold Boarder
Gold Boarder
Posts: 184
Karma: 16
More
Using PyIndi client with a simple GUI #24942

Lagreeni wrote: Hi,

I imported the IndiClient class from the script to my GUI and am trying to call newProperty, but I hit an issue with the arguments. I don't know how to call the functions ie: newProperty(self, p) because of the "p", property, parameter. I'm not very well versed with Python, so I imagine I'm missing something very obvious, but its doing a dang good job of eluding me. I'm not even sure if just calling the function newProperty or even nd18 would work.

Hi,
You don't have to call newproperty yourself, the IndiClient runs in its own thread and will call that function for every new property. You just have to define that function.
In your case, if every other aspects are managed from another client, you just need to remember the property and reuse it in your function:
class IndiClient(PyIndi.BaseClient):
    def __init__(self):
        super(IndiClient, self).__init__()
        self.dwheel = None
   def newDevice(self, d):
        pass #connecting the filter wheel via a basic client
   def newProperty(self, p):
        if p.getName() == "FILTER_SLOT":
             self.dwheel = p
    # you shoul define all other virtual functions and I would suggest also
    def removeProperty(self, p):
        if p.getName() == "FILTER_SLOT":
             self.dwheel = None

    def nd18(self):
        if self.dwheel:
            slot=self.dwheel.getNumber("FILTER_SLOT")
            slot[0].value=1
            self.sendNewNumber(slot)
I did not test but here is the idea.

tltr: How do you connect a GUI to a PyIndi client? Can you call one of the PyIndi functions such as newProperty(self, p) and if so, how?

As the Indiclient has its own thread, calling indi client from the gui should be ok, but calling the gui from the client (refreshing a value for instance) won't work without some sort of synchronization (queue, or use a Qthread for the indi client if you're in Qt).
Jean-Luc.
The following user(s) said Thank You knro, Lagreeni

Please Log in or Create an account to join the conversation.

1 year 7 months ago
Lagreeni
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Using PyIndi client with a simple GUI #25698
Hi Oleg,

This might be a really silly question, but on the gtkindiclient source (DCD-0.13 device control device) you linked to, I can't figure out where to actually download the module gtkindiclient.

Please Log in or Create an account to join the conversation.

1 year 7 months ago
oleg
Moderator
Moderator
Posts: 320
Karma: 5
More
Using PyIndi client with a simple GUI #25710

Lagreeni wrote: Hi Oleg,

This might be a really silly question, but on the gtkindiclient source (DCD-0.13 device control device) you linked to, I can't figure out where to actually download the module gtkindiclient.


You can run DCD in terminal:
cd dcd
./dcd.py

At first, you have to run the indiserver with driver(-s).

You can try my open project Astronomy Linux
Attachments:

Please Log in or Create an account to join the conversation.

1 year 7 months ago
Lagreeni
Fresh Boarder
Fresh Boarder
Posts: 9
More
Topic Author
Using PyIndi client with a simple GUI #25745
I don't understand though how I can edit the code for the GUI that dcd.py creates to make it my own. How would I go about doing that?

Please Log in or Create an account to join the conversation.

1 year 7 months ago
oleg
Moderator
Moderator
Posts: 320
Karma: 5
More
Using PyIndi client with a simple GUI #25747
You can write the letter to its author Dirk Hünniger.

You can try my open project Astronomy Linux

Please Log in or Create an account to join the conversation.

Time to create page: 0.784 seconds