Python Programmer for PDF storage repackaging

  • Posted:
  • Proposals: 2
  • Remote
  • #27259
  • Expired
Luke L.Shilpa S. have already sent a proposal.
  • 0


Experience Level: Entry
I am looking to develop and repackage an application. It is a PDF storage system which currently runs on python but cannot be installed on windows.
All of the required libraries already have been ported. I would like somebody to make this into a downloadable application that will run on windows.

The problems I have been told are as follow:

1) issue with threads (pygtk) in windows

2) issue with poppler

So as a first step we need to get the thread issue fixed so that will have it running (without pdf preview) and once it is done , we can add poppler.

Next hassle is compiling using py2exe and fixing all dependencies.

Finally use an inno script to glue all to a single exe

There are a couple of hitches you can run into when trying to use threading and PyGTK together. For starters, if you are using threads, no matter if you are doing PyGTK calls from a separate thread or not, you *must* compile PyGTK with --enable-threads.

Now there are two approaches for threads in PyGTK:

1. Allow only the main thread to touch the GUI (gtk) part, while letting other threads do background work. For this to work, first call
at applicaiton initialization. Then you launch your threads normally, but make sure the threads never do any GUI tasks directly. Instead, you use gobject.idle_add to schedule GUI task to executed in the main thread. Example:

import threading
import time
import gobject
import gtk


class MyThread(threading.Thread):
def __init__(self, label):
super(MyThread, self).__init__()
self.label = label
self.quit = False

def update_label(self, counter):
self.label.set_text(\"Counter: %i\" % counter)
return False

def run(self):
counter = 0
while not self.quit:
counter += 1
gobject.idle_add(self.update_label, counter)

w = gtk.Window()
l = gtk.Label()
w.connect(\"destroy\", lambda _: gtk.main_quit())
t = MyThread(l)

t.quit = True

2. Allow any thread to do GUI stuff. Warning: people doing win32 pygtk programming have said that having non-main threads doing GUI stuff in win32 doesn\'t work. So this programming style is really not recommended.

Anyway, to make this work, start by calling:

at startup. Failing to do this will make PyGTK never release the python threading lock. At least Debian\'s packages are compiled properly, so it\'s a matter of using that call.

Then you have to wrap your main loop with gtk.threads_enter()/gtk.threads_leave(), like this:


Your threads code must, before touching any gtk functions or widgets, call gtk.threads_enter(), and after gtk.threads_leave(), for example:

Also, keep in mind that signal handlers don\'t need gtk.threads_enter/leave(). There are other concerns, see

Cedric Gustin posted a short example of threaded code at -- it\'s a good building block for a more complex threaded application.

Finally, if you are writing a C extension module, remember that you need to protect calls that potentially lock the thread with Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS.

New Proposal

Create an account now and send a proposal now to get this job.

Sign up

Clarification Board Ask a Question

    There are no clarification messages.