Welcome, Guest
Username: Password: Remember me
25 Jul 2018
Glad to announce of release of INDI Library v1.7.4 on 2018-07-25. A few drivers were added in this release as we continue to improve & stabilize existing drivers.
Read More...
  • Page:
  • 1

TOPIC: Using PyIndi client with a simple GUI

Using PyIndi client with a simple GUI 6 months 5 days ago #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.

Using PyIndi client with a simple GUI 6 months 5 days ago #24929

  • oleg
  • oleg's Avatar
  • Away
  • Moderator
  • Moderator
  • Astronomy Linux
  • Posts: 312
  • Karma: 5
  • Thank you received: 92
Do you know about other INDI clients?
indilib.org/about/clients.html

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

You can try my open project Astronomy Linux

Using PyIndi client with a simple GUI 6 months 5 days ago #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.

Using PyIndi client with a simple GUI 6 months 5 days ago #24933

  • oleg
  • oleg's Avatar
  • Away
  • Moderator
  • Moderator
  • Astronomy Linux
  • Posts: 312
  • Karma: 5
  • Thank you received: 92

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

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

You can try my open project Astronomy Linux

Using PyIndi client with a simple GUI 6 months 5 days ago #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.

Using PyIndi client with a simple GUI 5 months 2 weeks ago #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.

Using PyIndi client with a simple GUI 5 months 2 weeks ago #25710

  • oleg
  • oleg's Avatar
  • Away
  • Moderator
  • Moderator
  • Astronomy Linux
  • Posts: 312
  • Karma: 5
  • Thank you received: 92

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).
Attachments:

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

You can try my open project Astronomy Linux

Using PyIndi client with a simple GUI 5 months 1 week ago #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.

Using PyIndi client with a simple GUI 5 months 1 week ago #25747

  • oleg
  • oleg's Avatar
  • Away
  • Moderator
  • Moderator
  • Astronomy Linux
  • Posts: 312
  • Karma: 5
  • Thank you received: 92
You can write the letter to its author Dirk Hünniger.

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

You can try my open project Astronomy Linux
  • Page:
  • 1
Time to create page: 0.188 seconds

Login



3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!


Gallery

Replica

Why INDI

Replica