Genie Torrent Search

Hello All!

I just completed my first application on which i was working since months. Here it is;

GenieTorrentSearch

It makes searching torrent from your phone 3 clicks away.

Genie Torrent Search is a mininova client. You can search mininova from your phone for .torrent files. Select the file of your choice and download it to your phone.

the downloaded file is saved in C:/Others

Download GenieTorrentSearch

then you can open the file in symtorrent and download the torrent.
Requirements:
Pys60
dialog (Download here-if saying certificate expired. change phone date to previous date)
pyexpat (Download Here)
appuifw2(optional) – (Download here)

Sorry i just completed and tested it, so have no screen shots.

Waiting for Comments..
Fayyaz Ali

Getting started with gaming on pys60

Hello All!

Today, i am going to show you how to start gaming on pys60.

In this example, i am going to show you basic key handling, how to draw graphics to screen?, how to move a graphic with the help of keypad? and how to clear the screen?

Here is the code;

# __author__='Fayyaz Ali'
# version = '1.0 beta'
# filename='GameSample.py'
# license='GNU GPL'

# import the required modules
import e32, appuifw, key_codes, graphics

# define the exit function
def quit():app_lock.signal()
appuifw.app.exit_key_handler=quit

# make the screen large
appuifw.app.screen='large'

global x,y
x = 110
y = 160

# this method is for handling the redraw event of canvas
def handle_redraw(rect):
     canvas.blit(img)

# this method is called when the ok button is pressed
def press_select():
    appuifw.note(u'hit','info')
    
# this method is called when the right button is pressed
def press_right():
    global x
    x=x+5
    update()
    
# this method is called when the left button is pressed
def press_left():
    global x
    x=x-5
    update()
    
# this method is called when the up button is pressed
def press_up():
    global y
    y=y-5
    update()
    
# this method is called when the down button is pressed
def press_down():
    global y
    y=y+5
    update()

def update():
    # clear img
    img.clear()
    # open an image
    img1=graphics.Image.open("e:\\Images\\area.png")
    # resize the image
    img2 = img1.resize((20,20))
    # copy the img1 to img
    img.blit(img2, (0,0), (x, y))
    handle_redraw(None)

# create an empty image according to the resolution of the phone
img=graphics.Image.new((240,320))

# create an object of the Canvas
canvas=appuifw.Canvas(redraw_callback=handle_redraw)

# bind the canvas with keys, so that it can listen to key presses of those keys and do some actions on each key

# we are passing two parameters to the bind method of canvas class. The first is the key code to which we want our application to listen to events. And the second is handler for the event.
canvas.bind(key_codes.EKeySelect, press_select)
canvas.bind(key_codes.EKeyDownArrow, press_down)
canvas.bind(key_codes.EKeyUpArrow, press_up)
canvas.bind(key_codes.EKeyRightArrow, press_right)
canvas.bind(key_codes.EKeyLeftArrow, press_left)

# set the application body to canvas
appuifw.app.body=canvas

update()

app_lock=e32.Ao_lock()
app_lock.wait()

Hope you enjoyed and learned from it.

Getting started with custom ui components in pys60

Hello!

Today, im going to show you how to start with developing custom ui components.

The ui component which we will be programming is selection_list like component and i named it ImageList.

note: the image area.png is a 40×240 image, this example is developed and tested on s60v3, if you wants to check it on another series, please change the images resoulotions accordingly.

Here is the code;

# __author__='Fayyaz Ali'
# version = '1.0 beta'
# filename='ImageList.py'
# license='GNU GPL'

import appuifw, e32, graphics

#Define the exit function
def quit():app_lock.signal()
appuifw.app.exit_key_handler=quit
appuifw.app.screen='large'
selectedindex=0

def handle_redraw(rect):
     canvas.blit(img)

def selected_index():
    return selectedindex

img=graphics.Image.new((240,320))

img1=graphics.Image.open("e:\\Images\\goback.gif")
img2=graphics.Image.open("e:\\Images\\area.png")



#draw list item background
img.blit(img2, (0,0), (2,2))
#draw list item icon
img.blit(img1, (-5,-12))
#draw list item text
img.text((30,30),u'List Text',(0,0,0),"title")

#draw list item background
img.blit(img2, (0,0), (2,44))
#draw list item icon
img.blit(img1, (-5,-54))
#draw list item text
img.text((30,72),u'List Text',(0,0,0),"title")

#draw list item background
img.blit(img2, (0,0), (2,86))
#draw list item icon
img.blit(img1, (-5,-96))
#draw list item text
img.text((30,114),u'List Text',(0,0,0),"title")

#draw list item background
img.blit(img2, (0,0), (2, 128))
#draw list item icon
img.blit(img1, (-5,-138))
#draw list item text
img.text((30,156),u'List Text',(0,0,0),"title")

#draw list item background
img.blit(img2, (0,0), (2, 170))
#draw list item icon
img.blit(img1, (-5,-180))
#draw list item text
img.text((30,198),u'List Text',(0,0,0),"title")

#draw list item background
img.blit(img2, (0,0), (2, 212))
#draw list item icon
img.blit(img1, (-5,-222))
#draw list item text
img.text((30,240),u'List Text',(0,0,0),"title")

#draw list item background
img.blit(img2, (0,0), (2, 254))
#draw list item icon
img.blit(img1, (-5,-264))
#draw list item text
img.text((30,282),u'List Text',(0,0,0),"title")

#draw scrollbar
img.line((236,0,236,328),0)
img.rectangle((235,105,238,215), fill=0x000000)

canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)

appuifw.app.body=canvas

app_lock=e32.Ao_lock()
app_lock.wait()

Our first control is ready but needs alot of more work, so see you soon.

Sample application skeleton

Here is the code;

__author__='Fayyaz Ali'
__version__ = '1.0 beta'
__filename__='STSampleApp.py'
__copyrights__='All rights reserved by swatiantigers team 2008'

#this module provides ui components for applications
import appuifw
#this module provides main loop like functionality
import e32

class STSample:
    def __init__(self):
        #lock for the script
        self.script_lock = e32.Ao_lock()
        #set the title of the application
        self.title = appuifw.app.title=u"STSampleApp"
        #create application menu
        self.menu = [(u'Sample', self.sample), (u'About', self.about), (u'Exit', self.destroy)]
        #set exit key handler for the application
        appuifw.app.exit_key_handler = self.destroy
        #set the application menu
        appuifw.app.menu=self.menu
        #set the application body to be empty
        appuifw.app.body=None
        self.script_lock.wait()

    def about(self):
           appuifw.note(u'About STSampleApp','info')

    def sample(self):
        appuifw.note(u'STSampleApp Action','info')

    def destroy(self):
        appuifw.app.exit_key_handler = None
        self.script_lock.signal()

x=STSample()

The above code is licensed under gnu gpl license.

Getting started with blogging from pys60 through xmlrpclib

Hello Every one!

Here is my sample code;
You will need xmlrpclib to run the code below; copy it from your python22 installation directory to your phone where you have the code below saved. you can place it in your phone memory or memory card. ped editor is recommended for running the code and making changes.

# First of All Create a server proxy for your xml rpc server
# The Xml rpc server in this case is "https://faali.wordpress.com/xmlrpc.php"
server = ServerProxy("https://faali.wordpress.com/xmlrpc.php")

# import the socket module of pys60
import socket

# Show a list of Access Points
apid = socket.select_access_point()

# get the selected access point
apo =socket.access_point(apid)

# set the access point as default
socket.set_default_access_point(apo)

# start the access point, so that it connects to the network and get its ip etc.
apo.start()

try:
    # print the addTwoNumbers(1,2) and call the method on server which give us the output of 3
    print 'addTwoNumbers(1,2) = ', server.demo.addTwoNumbers(1,2)

    # call the supportedMethods() method of the server and print the supported methods
    print 'supported methods: \n', server.mt.supportedMethods()
except Error, v:
    print "ERROR", v

    # stop the access point. if an error occurs
    apo.stop()

apo.stop()
apid=None
apo=None

Above code is written by Fayyaz Ali and is Licensed under gnu gpl.

Starting with PyS60 Programming

First of all i will like to welcome you to PyS60.

Before starting the Hello World App, you should know about python and pys60.

To know about Python, please visit python.org.
To know about PyS60, Please visit pys60.sourceforge.net.

The next step is that you should have Python for Series 60 and the python shell installed on your phone or you should have it on emulator.
To download, please visit here.

Install python for series 60 and Python Shell on your phone.

Now, You are ready for the Start;

Open “Python”, Click “Options”, Select “Interactive Console”

Now type the following line;

print “Hello World”

You will see the output;

Hello World

Now type the following line;
1+1

You will see the output;
3

Thats the end of our first short tutorial, see you soon with our next tutorial.