pncconf

More
28 Feb 2013 21:02 #30678 by BigJohnT
pncconf was created by BigJohnT
Hi Chris,

I'm trying to figure out how you did the combo boxes in pncconf. When I opened the pncconf.glade file with glade I got an error about missing gnome so I added that via the package manager. Now when I open pncconf.glade I can only see the splash screen and the dialog screens.

I've studied the fill_combobox_models method but don't quite get the whole picture. If you can point me somewhere to look I'd appreciate it.

Thanks
John
The following user(s) said Thank You: emad_ahmed2

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

More
01 Mar 2013 10:58 #30707 by cmorley
Replied by cmorley on topic pncconf
Pncconf can only be opened and save properly with ubuntu 8.04.

Pncconf's combo boxes functions are extremely complicated.

Can you give me a sample for what you would like to put in yours?
do you want two levels of drop downs like pncconf or is one enough?

Chris M

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

More
01 Mar 2013 19:16 - 01 Mar 2013 19:19 #30714 by BigJohnT
Replied by BigJohnT on topic pncconf
So the glade file can only be opened in 8.04?

I was hoping to do something similar to this



But if it is overly complicated I don't want to take up a lot of your time.

By one level do you mean a normal combo box? I have mastered this much so far with combo boxes.

Thanks
John
Attachments:
Last edit: 01 Mar 2013 19:19 by BigJohnT.

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

More
02 Mar 2013 14:24 #30752 by cmorley
Replied by cmorley on topic pncconf
By two level I meant a dropdown list inside a drop down list AKA treeview.
simple combo boxes oly have a single list of choices.

I never could find a tutorial for a treeview combobox so pieced it together from related stuff.

Here are some sample files I used to figure out how to have a treeview in combo boxes.
There are also two other files to show a treeview not in a combobox and a fairly plain combobox.
Run these from a terminal - most have debug output.

Hope that helps. I can show you a link to help with figuring out tree iters if you need it.

File Attachment:

File Name: treeview_samples.zip
File Size:3 KB



Chris M
Attachments:
The following user(s) said Thank You: BigJohnT

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

More
02 Mar 2013 19:35 #30757 by BigJohnT
Replied by BigJohnT on topic pncconf
Chris,

Thanks for the examples the treecombobox.py is the one I was looking for.

Thanks
John

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

More
05 Mar 2013 08:41 #30889 by arvidb
Replied by arvidb on topic pncconf

Pncconf can only be opened and save properly with ubuntu 8.04.


I will take the opportunity to ask: how do you develop pncconf in practice? I've opened the pncconf.glade file in glade-3.8.1, and it seems to work, but it takes something like 15 minutes! Do you keep it always open? ;)

Through some command-line-fu I've managed to split the .glade file into five separate files each containing one of the top-level windows (window1, helpwindow, openloopdialog, scaledialog, and tunedialog). Window1 still takes forever to open, but the others are now quick. I'm a complete beginner at glade, but I believe that it is possible to split a project over several files?

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

More
05 Mar 2013 11:09 - 06 Mar 2013 12:45 #30891 by arvidb
Replied by arvidb on topic pncconf
I'm also new to Python (I believe I could call myself an expert C programmer though and I'm also well-versed in object oriented programming and design).

So here's a Python specific question: in your Data class, you seem to treat self as a Python Dictionary. For example:
self[temp+"drivertype"]= "custom"
Does this create an "invisible" dictionary variable as an instance variable of self? Or what's going on there? (I've tried to google it but no luck.)

Well, anyway... perhaps I can be of some help adding more structure (and a more object oriented approach) to PnCConf, if you want me to?
Last edit: 06 Mar 2013 12:45 by cmorley.

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

More
05 Mar 2013 22:08 #30919 by BigJohnT
Replied by BigJohnT on topic pncconf
Chris,

The last piece of the puzzle fell into place this morning and I have a better understanding of the combobox treestore.

Thanks for the examples they helped a ton.

John

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

More
06 Mar 2013 12:45 #30954 by cmorley
Replied by cmorley on topic pncconf

I'm also new to Python (I believe I could call myself an expert C programmer though and I'm also well-versed in object oriented programming and design).

So here's a Python specific question: in your Data class, you seem to treat self as a Python Dictionary. For example:
self[temp+"drivertype"]= "custom"
Does this create an "invisible" dictionary variable as an instance variable of self? Or what's going on there? (I've tried to google it but no luck.)

Well, anyway... perhaps I can be of some help adding more structure (and a more object oriented approach) to PnCConf, if you want me to?


Well I'm a self taught programmer. PNCconf was my first Python program.
It is based on stepconf which Jeff Eppler wrote (he is a programmer).
I hacked my way to a functioning program. It's ugly and complicated and inconsistently written without a clear plan.

The particular line you quoted is part of an initializing sequence of data. (and it's a class of data as well)
Here is a very shortened version:

class Data:
def __init__(self):

for temp in("x","y","z","a","s"):

self[temp+"drivertype"]= "custom"
self[temp+"steprev"]= 200
self[temp+"microstep"]= 5

def __getitem__(self, item):
return getattr(self, item)
def __setitem__(self, item, value):
return setattr(self, item, value)

The two special methods allow self[ ] to work.
In this case I am using them to allow me to use a for loop to initialize common data to all the axes.

If you would like to hack on PNCconf - that would be great.

I would like to break it up a bit into a couple of files.
There is dead code to remove ( the never-could-get-it-to-work-happily test panel)
The HAL file printing should be broken out of the data class I think.
I need to figure out what I am going to do about the glade problem (The druid widget is broken in newer versions then dropped in the newest version)
and the assistant widget that replaces it has problems too - or at least it did the last time I looked.
And I really need a different data model for Mesa pins....

I am preoccupied at the moment with Gscreen....

Chris M

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

More
06 Mar 2013 12:46 #30955 by cmorley
Replied by cmorley on topic pncconf

Chris,

The last piece of the puzzle fell into place this morning and I have a better understanding of the combobox treestore.

Thanks for the examples they helped a ton.

John


Your very welcome John!
samples to look at yet ???

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

Moderators: cmorley
Time to create page: 0.121 seconds
Powered by Kunena Forum