Cyberpython Online

Java: Native GTK+ GUIs on Gnome using Java-Gnome

Posted in Linux, java, programming, Προγραμματισμός by cyberpython on Νοεμβρίου 17, 2009

In this post we’ll see how to create a simple text editor for Linux systems using Java and GTK+.

First of all we will need to have a Linux system with:

  • JRE and JDK
  • GTK (if you are using a Gnome-based distro like Ubuntu it’s already there)
  • Gnome-Java GTK+ bindings for Java
    If you are using Ubuntu Karmic you can install these with:
    sudo apt-get install libjava-gnome-java libjava-gnome-jni libjava-gnome-java-doc
    Otherwise you can grab the bindings from here and follow these instructions for manual installation.
  • Glade Interface Designer (It must be available through your distribution’s package management tool)
  • Your favorite Java editor/IDE – I’ll be using Netbeans (if you don’t, make sure you have a grasp of how the classpath works).

(περισσότερα…)

Tagged with: ,

Διορθώστε το χρώμα της tab bar στον Chromium

Posted in Uncategorized by cyberpython on Νοεμβρίου 3, 2009

Ο Chromium (όπως και ο Chrome) σε πολλές περιπτώσεις δεν χρησιμοποιούν το κατάλληλο χρώμα ώστε η tab bar να μοιάζει ως συνέχεια του πλαισίου του παραθύρου (όταν βέβαια έχουμε επιλέξει να γίνεται χρήση του GTK theme και των πλαισίων παραθύρων του συστήματος).

Για να το διορθώσουμε αυτό, πρέπει να επέμβουμε στο αρχείο .gtkrc του θέματος που χρησιμοποιούμε.

(περισσότερα…)

Tagged with: , , , ,

Νέα Gtk και Metacity themes

Posted in artwork by cyberpython on Οκτωβρίου 15, 2009

Εχθές είχα καλλιτεχνικές ανησυχίες και έτσι έχουμε ένα νέο GTK+ theme:

Clearlooks Bright Gummy:

Screenshot
Screenshot-The Widget Factory

και ένα νέο Metacity theme με 3 παραλλαγές:

GlossyTop:

Screenshot-normal

Screenshot-focus

A simple weather program in Python

Posted in programming, Προγραμματισμός by cyberpython on Σεπτεμβρίου 27, 2009

The following program fetches an XML file from http://weather.yahooapis.com and displays the current weather information the file contains.

I wrote this program in order to use it in combination with conky. The result looks like this:

Screenshot-92
(περισσότερα…)

Tagged with:

Basic HTTP Authentication in Python using API keys

Posted in programming, Προγραμματισμός by cyberpython on Ιουλίου 29, 2009

Python’s standard library provides a great and simple way – via PasswordMgr and HTTPBasicAuthHandler – to provide credentials used for basic HTTP authentication, but (at least as far as I know) it can be used only for username-password pairs.

The problem is that sometimes – for example if you want to retrieve an xml file from gnome-look.org – you want to use an API key for authentication. To achieve that all we have to do is encode the API key with the Base64 algorith and then send it along with our HTTP request included in a basic authentication header (Note: For some reason the encoded string that I got using Python’s Base64 implementation included a line break that messed things up, so it might be wise to encode the API key by hand and then insert it to your code):

def download_file(url, API_KEY_BASE_64):
    req = urllib2.Request(url)
    req.add_header("Authorization", "Basic "+API_KEY_BASE_64)
    return urllib2.urlopen(req)

Of course you will have to import urllib2 (urllib in Python3).