Showing posts with label MyApps. Show all posts
Showing posts with label MyApps. Show all posts

Thursday, July 22, 2010

New Download Manager for Linux

Liquid Fuel Cell Candle Lamp
RoxBird is a Advanced and Graphical download manager written in Python and C
based GTK+ GUI.. It can accelerate your download speed upto 40% then normal.
This is my first personal project for Linux and also in PC softwares.


Screen short: (view more screen shorts)

RoxBird in action

Please visit  ThisPage to view more.


Vigil Candles

Wednesday, April 28, 2010

Solution for multithreaded GTK+ GUI hang and Random Crash.


Here is a solution that i found for multi-threaded PyGTK+ GUI hang/Crash. After a long search i found this code in some where on the internet, but i can't remember where is it really placed.


For What:
GTK+ is not thread safe, So we have to use "gtk.gdk.threads_enter" and "gtk.gdk.threads_leave" for that. This will make threading safe on GTK+, Like this
#!/usr/bin/env python
# -*- coding: utf-8 -*-
gtk.gdk.threads_enter()
#Handling GTK+ GUI
gtk.gdk.threads_leave()

but some time GUI hangs when same thread acquire this lock  for more than one time like this.
gtk.gdk.threads_enter()
#Handling GTK+ GUI
gtk.gdk.threads_enter()  #************ 
#again Handling GTK+ GUI
gtk.gdk.threads_leave()
So we have to find is this thread has it's lock already or not and make lock.
here is the code that will track threads and find is that really has it lock or not and make correct Locks.

Code:Download
class Check_For_Lock:
        def __init__(self):
                self.lock = threading.Lock()
                self.thread = None
                self.locked = 0
        def __enter__(self):
                with self.lock: DoLock = (thread.get_ident()!=self.thread)
                if DoLock:
                        gtk.gdk.threads_enter()
                        with self.lock: self.thread = thread.get_ident()
                self.locked += 1
                return None

        def __exit__(self, exc_type, exc_value, traceback):
                with self.lock:
                        self.locked -= 1
                        if self.thread!=thread.get_ident():
                                print "!ERROR! Thread freenot locked lock!"
                                sys.exit(0)
                        else:
                                if self.locked == 0:
                                        self.thread = None
                                        #Added BY me  SEE WHY?:
                                        #http://library.gnome.org/devel/gtk-faq/stable/x491.html
                                        gtk.gdk.flush()
                                        gtk.gdk.threads_leave()
                return None
TLocker = Check_For_Lock()

def TLocked(f):
    def wraps(f):return f
    #@wraps(f)
    def wrapper(*args, **kwds):
        with TLocker.lock:
            if TLocker.thread == None or TLocker.thread==thread.get_ident():
                TLocker.thread = thread.get_ident()
                TLocker.locked += 1
                WeHold = True
            else:
                print "***ERROR: GtkLocked for non-owned thread!"
                WeHold = False
        ret = f(*args, **kwds)
        if WeHold:
            with TLocker.lock:
                TLocker.locked -= 1
                if TLocker.locked == 0: TLocker.thread = None
        return ret
    return wrappr
I used this code for my project RoxBird Download Manager.
I got so many crashes on RoxBird. after that i removed gdk.threads_enter()/leave() and used this, Now RoxBird have a stable GUI.

you can use it simply like this

with TLocker:
    #Make changes on GTK+ GUI.
    window.set_size_request(400, 300)
#Connecting Signal via threads
widget.connect('signal_name', TLocked(CallFunction), UsrArg1, UsrArg2, ...)


Notes: 
  • You should create "gtk.gdk.threads_init()" after importing "gtk" module.  
  • You should use only one Instance of TLocker for the all application. (you can use reference for TLocker)
  • In threads all GUI handling should be inside of the "with TLocker" block.
  • "widget.connect" should called with TLocked like above, and connect statement should not inside of the "with TLocker" 
if i miss something on code or notes, feel free to comment.

Wednesday, November 11, 2009

RoxerDownloadManager [rdm]v0.9-1alpha for Linux

 

RoxerDownlaod Manager

RoxerDownloadManager is a power full download manager for linux systems.
based on python.Currently rdm-alpha version with basic features like mapGUI,Download categorisation ,connection UnBreakable pausing ,saperate
moniters like window's IDM. (each downloading have its won window.), TrayIcon,
auto starting etc... Special feature of RDM is mmulticonnection downloading.that is RDM download a single file via more than one connection, So your downloading is really faster than other download managers. RDM based on Python,and GUI based on wxPython.   

Just give a try on RDM and say your feedback.    

Please Read Technical details here to get best performance on RDM .

Download RDM9.0-1 alpha

If you need source file for RDM, please contact me.

RoxerDownloadManager


Click to see Large ScreenShort

RoxerDownloadManager 

Just give a try on RDM and say your feedback.

Don't forget to give a feedback.

Thankyou. 


Creative Commons License 

RoxerDownloadManager[RDM] by Baskar is licensed under a Creative Commons Attribution 2.5 India License.