Starting Python development

Contribute code to SolydXK and make it even better.
User avatar
ScottQuier
Posts: 1779
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 17 May 2014 12:40

Oh, you have been a busy boy! I've just added your site to my Glade/Python favorites list.
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

RavenLX

Re: Starting Python development

Postby RavenLX » 17 May 2014 16:31

Thank you to both of you. It's almost 12:30 pm and I just now woke up. Went to bed at 6:00 am. I bet that'll happen again if I get started in some Linux project. :D

User avatar
ScottQuier
Posts: 1779
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 17 May 2014 16:39

You've got the disease and baaadddd! :) :D :lol:
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

RavenLX

Re: Starting Python development

Postby RavenLX » 17 May 2014 16:59

I was born with it! :twisted:

Ever since I sat down at a computer, I couldn't get myself away from it. Maybe I should move my operations here (it would be most convenient, at least) :lol:

Image
(Image courtesy http://www.sodahead.com/question/418946 ... q=Computer)

(My apologies for going off topic. But maybe this be a warning to those thinking of developing: It could get that addictive! :mrgreen: )

RavenLX

Re: Starting Python development

Postby RavenLX » 17 May 2014 22:03

On a serious note: I've removed my tutorial on compiling newer versions of Glade because I can't get it to actually work and run a glade/python project. If I compile it with glade3, then when running a python/glade project it complains that some dependencies aren't met. And you can't compile a newer version unless it requires gtk3. It's another "dependency hell". While Scott's very large command line would work, it's too big (do we really need to install cvs and all that other stuff just for learning from tutorials, for example?) I had a hard time determining what packages are absolutely necessary and what can be omitted. So for now I've put that one on the back shelf and am going with Schoelje's suggestions. (Sorry Scott. Perheps I can get it working again some time or just make it for GTK+2 or something in the future).

User avatar
ScottQuier
Posts: 1779
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 17 May 2014 23:32

No worries. I install all that mess because
  1. It's a development machine
  2. I found that list somewhere and didn't want to take the time to tear it apart to figure out what, exactly, was needed
  3. It works, it's got everything I need and the kitchen sink.
  4. And the cost, in terms of space, was not large enough to cause alarm
But, you're right. For the purposes of someone just wanting to work with tutorials, that may be a bit over-kill.

But, then again, I don't have any issues working with either Gtk+ 2.7 or Gtk+ 3 project. They just work.
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

RavenLX

Re: Starting Python development

Postby RavenLX » 18 May 2014 00:07

More bad news. Tried my instructions based on Schoelje's command line. Didn't work. I'm getting

Code: Select all

(tutorial-1.py:4344): GLib-GObject-ERROR **: cannot create instance of abstract (non-instantiatable) type 'GtkBox'
Trace/breakpoint trap
so I haven't a clue hot to fix it. I might have to put that document on hold as well. I don't understand it because last night it worked. Now it doesn't. Same conditions. (Fresh iso, etc. with VirtualBox extensions). I have to do more experimenting.

Anyone else out there want to try my instructions (in the OP link) using a fresh install?

User avatar
ScottQuier
Posts: 1779
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 18 May 2014 00:25

If you're a bit more specific as to what instructions you want tested, I'll take the time away from my oh so busy life to give you a helping hand :D :lol:

The link in the OP points to your index page - just too many chances to guess wrong and waste a bunch of time before getting it right. My first guess would be --> http://cgi.bytebin.net/linux/dev/pythonglade.php

Did I guess right?

It would also be nice if you could attach a zipped copy of your .glade file and a short step-by-step of what it is/was you were doing to generate that error message. With out that bit of help, I would be stumbling in the dark - not my favorite past-time. :)
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

RavenLX

Re: Starting Python development

Postby RavenLX » 18 May 2014 00:59

Thanks, Scott! You guessed right. That's the right article.

I figured it out: In the glade file you have to change GtkBox to GtkVBox. Then I'd get ton of errors that margin_* property doesn't exist.

In short, the version of Glade that is in the repos does not work with the version of GTK+ and Python that is in the repos. This is on a fresh install.

Right now I'm going to try 3.8 and see what happens. I'm just trying stuff right now. It will take me a bit to get some step-by-step test instructions so bear with me. In fact, I might not get to it tonight (it's already almost 9pm and I don't want to go to bed at 6:00 am again. :lol: )

I'll post some testing instructions tomorrow.

User avatar
ScottQuier
Posts: 1779
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 18 May 2014 01:10

That's fine. Just know that I have SolydX-Fresh VM just waiting for you! I hope you get a chuckle from the hostname I selected for this VM :)

Code: Select all

scott@ravenlx:~/Desktop$ inxi -Fxxx
System:    Host: ravenlx Kernel: 3.13-1-amd64 x86_64 (64 bit, gcc: 4.8.2) 
           Desktop: Xfce 4.10.2 (Gtk 2.24.18) info: xfce4-panel dm: lightdm Distro: SolydXK 1 testing
Machine:   System: innotek product: VirtualBox version: 1.2 Chassis: Oracle type: 1
           Mobo: Oracle model: VirtualBox version: 1.2 Bios: innotek version: VirtualBox date: 12/01/2006
CPU:       Dual core AMD FX-8320 Eight-Core (-MCP-) cache: 4096 KB flags: (lm nx sse sse2 sse3 ssse3) bmips: 15106.9 
           Clock Speeds: 1: 3776.733 MHz 2: 3776.733 MHz
Graphics:  Card: InnoTek Systemberatung VirtualBox Graphics Adapter bus-ID: 00:02.0 chip-ID: 80ee:beef 
           X.Org: 1.15.0 drivers: vboxvideo (unloaded: fbdev,vesa) Resolution: 1600x1200@60.0hz 
           GLX Renderer: Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits) GLX Version: 2.1 Mesa 10.1.0 Direct Rendering: Yes
Audio:     Card: Intel 82801AA AC'97 Audio Controller 
           driver: snd_intel8x0 ports: d100 d200 bus-ID: 00:05.0 chip-ID: 8086:2415 
           Sound: Advanced Linux Sound Architecture ver: k3.13-1-amd64
Network:   Card: Intel 82540EM Gigabit Ethernet Controller 
           driver: e1000 ver: 7.3.21-k8-NAPI port: d010 bus-ID: 00:03.0 chip-ID: 8086:100e
           IF: eth0 state: up speed: 1000 Mbps duplex: full mac: 08:00:27:42:de:fc
Drives:    HDD Total Size: 21.5GB (21.5% used)
           1: id: /dev/sda model: VBOX_HARDDISK size: 21.5GB serial: VB58384777-10f9753a 
Partition: ID: / size: 18G used: 4.3G (26%) fs: ext4 ID: swap-1 size: 2.15GB used: 0.00GB (0%) fs: swap 
Sensors:   None detected - is lm-sensors installed and configured?
Info:      Processes: 146 Uptime: 13 min Memory: 506.9/3964.5MB Runlevel: 2 Gcc sys: 4.8.2 alt: 4.6/4.7 
           Client: Shell (bash 4.3.0 running in xfce4-terminal) inxi: 1.9.17 
scott@ravenlx:~/Desktop$ sudo apt-get dist-upgrade 
[sudo] password for scott: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
scott@ravenlx:~/Desktop$ 
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

User avatar
zerozero
Posts: 5373
Joined: 10 Feb 2013 23:37
Location: West Midlands, England
Contact:

Re: Starting Python development

Postby zerozero » 18 May 2014 01:37

RavenLX wrote:In short, the version of Glade that is in the repos does not work with the version of GTK+ and Python that is in the repos. This is on a fresh install.
but AFAIK the version of glade in the repos is broken and you need glade 3.16.x (i believe that 3.18 requires gtk3.12 so it's a no-go)
bliss of ignorance

RavenLX

Re: Starting Python development

Postby RavenLX » 18 May 2014 02:25

@Scott: Love the hostname! :mrgreen:

Guys, I got it working!! :) I don't believe it but yes, it's working! I'm using the version Schoelje recommended that is in our repos.

First, if you follow the tutorial at http://gnipsel.com/glade/index.html it is quite outdated and you have to make some changes.

1. When designing the Glade file, you want to use GtkWidget - destroy as there is no GObject in 3.14 (the version in the repos).

2. Because it's a "newer" version, you need to install the 'gobject-introspection' package.

3. The Python file must also be altered. Don't use the /usr/bin/env python. Be sure you get Python 3 by using /usr/bin/python3.

4. Do not use # import gtk but instead define it from the gobject-introspection by using 'from gi.repository import Gtk'.

5. All references to 'gtk' in the code need to thusly be changed to 'Gtk' (upper case 'G').

Then the python/glade file will work no problems! :) Not bad for getting a broken package to work!

If you don't want to go through all that and you rather use the older gtk, I'm finding that 3.8 works fine. I could not get 3.16 or 3.18 to work. I'll work on that this weekend some more though and see what I can do. But for now, I did get 3.14 to actually work.

Scott and anyone else wanting to try this, first do this command line to install python/glade

Code: Select all

sudo apt-get install -y libgladeui-common libgtk2.0-dev glade devhelp devhelp-common gobject-introspection
Then try out the attached code (both files need to be in the same directory).

It should work. You can quit the accplication from the file menu or the 'x' button in the title bar (it's all this app is supposed to do).
Attachments
tutorial-1.glade.tar.gz
Sample Glade Tutorial from gnipsel altered by RavenLX to work with the python/glade from the repos
(1.63 KiB) Downloaded 77 times

RavenLX

Re: Starting Python development

Postby RavenLX » 18 May 2014 02:26

Question (and a very very stupid one at that)... what is a broken package doing in the repos? When will it be 'fixed'? (Sorry, I don't know how that all works.)

RavenLX

Re: Starting Python development

Postby RavenLX » 18 May 2014 02:43

I've updated my web site to reflect the newfound knowledge: http://cgi.bytebin.net/linux/dev/pythonglade.php

User avatar
ScottQuier
Posts: 1779
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 18 May 2014 02:59

Just an FYI - 3.14.x in the repos is broken in more than just one way. I abandoned it because I could get it to crash whenever I wanted to doing "normal" building operations. One such was adding data to a ListStore object. Do it just wrong and glade would crash and all you input from the time of the last save was gone. I was also able to get it to crash when attempting to save a .glade file. That was not fun.

Those are the reasons I figured out, with a bunch of help from zerozero, how to compile 3.16.1 and way I now use that instead of the version in the repos.
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

RavenLX

Re: Starting Python development

Postby RavenLX » 18 May 2014 03:11

Maybe I should just update my pythonglade.php to use the latest version of glade and how to compile it? I'm working on it now, actually. It will include compiling gtk+3.12 (Thanks zerozero :) ) and glade 3.18. If that doesn't work, I'll go and retry 3.16 again. While I may get things to compile, getting it to actually work will be another matter.

I may be doing the rest of this tomorrow since I don't want to be up all night again. :lol: But I'll keep you guys posted!

User avatar
zerozero
Posts: 5373
Joined: 10 Feb 2013 23:37
Location: West Midlands, England
Contact:

Re: Starting Python development

Postby zerozero » 18 May 2014 03:18

when i said broken i was referring this bug, the same as Scott AFAIK (apparently 3.18 is still marked as affected but 3.16 was working fine in both Scott's and Schoelje's tests)

debian has indeed a mechanism to purge long lasting broken packages from the archive (and not only "broken" but also unmaintained or dead upstream); usually it's not a very pleasant experience for the users that rely on those packages/app to see them suddenly disappear.

this is a different situation: it's "normal" for a given app/lib to have a bug but as long as a newer version or a bug-fixing version is at sight it won't be removed
bliss of ignorance

User avatar
ScottQuier
Posts: 1779
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Starting Python development

Postby ScottQuier » 18 May 2014 03:22

RavenLX wrote:Maybe I should just update my pythonglade.php to use the latest version of glade and how to compile it? I'm working on it now, actually. It will include compiling gtk+3.12 (Thanks zerozero :) ) and glade 3.18. If that doesn't work, I'll go and retry 3.16 again. While I may get things to compile, getting it to actually work will be another matter.

I may be doing the rest of this tomorrow since I don't want to be up all night again. :lol: But I'll keep you guys posted!
Did you see zerozero's post --> http://forums.solydxk.nl/viewtopic.php? ... ead#p35807

I don't think you'll get much traction with 3.18 until our repos catch up. But, you could find the magic decoder ring to make it happen.
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

RavenLX

Re: Starting Python development

Postby RavenLX » 18 May 2014 03:37

Saw it after I posted. I will abandon trying to get 3.18 to work then, if it's already known to have the same bug. I'll try to get 3.16 working (I won't need gtk+3.12 in that case so it'll save some work as well).

User avatar
Arjen Balfoort
Site Admin
Posts: 8689
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Starting Python development

Postby Arjen Balfoort » 18 May 2014 07:28

I haven't read all the posts (way to many), but remember this: your system has python2.7, and python3.x installed.
If you run:

Code: Select all

python /path_to.py
python2.7 is used, and you'll get errors like the GtkBox for your Gtk+ project. Python2 uses GtkVBox, and GtkHBox.
If you want to run a python3 project, you'll need to explicitly run your script by:

Code: Select all

python3 /path_to.py
(check out the bash /usr/bin/usermanager on SolydX).

Or put these line at the top of your .py file:

Code: Select all

#! /usr/bin/env python3
#-*- coding: utf-8 -*-
The second line just tells Python to utf-8 encode, and I use that as default on all my applications in case we're going to use translations (which we do).
Check out /usr/bin/updatemanager.


SolydXK needs you!
Development | Testing | Translations


Return to “Code”

Who is online

Users browsing this forum: No registered users and 1 guest