After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 541316 - Windows port
Windows port
Status: RESOLVED FIXED
Product: hamster-applet
Classification: Deprecated
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: hamster-applet-maint
hamster-applet-maint
: 573083 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-07-02 21:25 UTC by Michael Tiller
Modified: 2012-09-24 18:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
windows port patch (57.30 KB, patch)
2009-10-21 17:52 UTC, Martins Polakovs
none Details | Review
Windows Port Patch (489.29 KB, patch)
2011-03-20 21:05 UTC, Matthew
none Details | Review

Description Michael Tiller 2008-07-02 21:25:11 UTC
I would like to run hamster under Windows.

I downloaded the latest SVN of Project Hamster along and tried to run it
under Windows.

As part of this, I had to go through and remove bits that used the gnome,
gconf and applet modules.  But these are actually surprisingly tiny
fragments of code.

I managed to get the application to run without any errors in standalone mode!

Unfortunately, it isn't very exciting because the UI is missing.  I'm not
quite sure why but here are some guesses.

1. I didn't do any of the "autotools" stuff because I'm running on Windows
(no Cygwin).  I tried to "fake it" by making my own version of defs.py
(from defs.py.in) by hand and guessing a bit about what the various
variables represent.

2. When attempting to get it running I noticed lots of SQL code in the
trace.  It appears it made a database of somekind, but I don't see any
files laying around.  I'm not sure where SQLite is storing that data?!?  It
may be that the database is corrupted but since I can't find the database
to remove it, I'm a bit stuck.

3. There could always be some incompatibility with the Windows platform but
since I've stripped it down to use PyGTK exclusively I would expect that it
would work.

Remember that I don't get any errors (or even any indications in the trace)
about why UI is missing.

I'd be happy to play around with it a bit more and report back on what I
find if I could get some guidance on how to proceed and what to look at.

Thanks.
Comment 1 Michael Tiller 2008-07-02 21:27:01 UTC
Would it be possible to get some contact information for the developers.  I suspect that working through all the Gnome specific issues might be rather tedious through Bugzilla.  I'm happy to update this ticket with status information and any results but I just think the discussion itself would be better via email.  I was unable to locate a mailing list, web forum or email address anywhere on the project page.
Comment 2 Michael Tiller 2008-07-02 21:29:38 UTC
I got a reply from developers about the potential issues with running on Windows.  I want to reiterate that there were surprisingly few Gnome/Applet dependencies.  After my modifications the application runs in stand-alone mode.  I suspect what might be going on is that it isn't properly loading the GLADE files.  I have to dig deeper to make sure it is finding them.  It isn't throwing any errors but I'm concerned it is silently failing.  This could easily be caused by an incorrect "defs" module.
Comment 3 Toms Bauģis 2008-07-02 21:50:51 UTC
Ok Michael,

Thanks for putting it here :)

Having a ticket means that it is publicly available, can be easily found and is not forgotten. Take it as a topic-oriented mailing list :)

I guess you do have some experience with python, because otherwise you wouldn't be able to do the modifications, but still - there will be some hard parts.
I've never tried to port an applet to windows, but i suspect there will be some trouble. Two things come to my mind: SQLite & paths and converting applet into systray app.

Anyway, if you were able to do the modification, you should also be able to run hamster from the commandline and track the problems. 

I'm afraid, me myself, i won't be of big help right now.


Comment 4 Michael Tiller 2008-07-07 14:06:50 UTC
Yes, I've got plenty of Python experience but no real Gnome or GTK experience.

What I'd like to start with is just running it as "standalone".  So I don't run it as an applet but rather as a GTK application, right?

I have a couple of questions.  First, when I grabbed the source for the first time I saw (in the debugging output) a bunch of stuff that looked like it was pushing SQL commands to SQLite.  I assumed it was initializing the database.  However, if I delete the SQLite database file and run it, I don't see any such activity now.  Is there some state somewhere that I'm missing that somehow leads it to think it is initialized already?  I don't seem to be getting any error messages about a missing database file?!?

Another question is what to do about some of the ".in" files.  Most of them I think I can ignore because they are related to bits I've commented out (e.g. the gconf schemas).  I'm focusing on defs.py.in -> defs.py.  This is how I filled it in, does this look correct?

---
DATA_DIR = "C:/Documents and Settings/mtiller/My Documents/Source/Junk/ProjectHamster/data"
LIB_DIR = "C:/programs/Python25/Lib"
VERSION = "2.5"
PACKAGE = "hamster"
PYTHONDIR = "C:/programs/Python25"

import sys, os.path 
sys.path.append(".libs") 
---

Finally, I'm wondering what kind of refactoring is necessary to avoid the Gnome specific extensions?  I would suspect that the core of this is GTk based and should run in Windows but it isn't quite clear to me how to get the whole "glade" related stuff kicked off without going through Gnome.  Any suggestions?
Comment 5 Toms Bauģis 2008-07-07 21:42:22 UTC
1) regarding database initialization - it check's for the db file, if there is none, it gets initiated (search for "run_fixtures" in code)

2) all the .in files should turn into files without the .in extension, containing generated code. On some occassions i'm not sure about contents of those .in files, since they have been basically copied from deskbar applet (scientific induction'n'such, huh).

3) regarding refactoring - in most cases there should be some fallback behaviour.
For example - if we can not get idle time - just don't have any, and disable UI interface. If there is no gconf (allthough there should,  i think), then one should fallback to some sane defaults, and so on.
No particular pattern, i guess, just the code should be readable.

Regarding the glade stuff kicking off without gnome - i don't really know what you are talking about, maybe try googling for it.

Comment 6 Martins Polakovs 2008-11-09 02:30:22 UTC
I have created windows port for current trunk code (rev. 621). At least it`s working and running for me :)

Some notes + setup and source can be found here: http://sites.google.com/site/projecthamsterwindows/

This was my first experience with python+gtk stuff, so don`t judge strictly :)

Basically the port should run also on linux, I used conditions like: "if not IS_WINDOWS" to escape gnome/gconf/dbus code. Configuration is stored in ini like file instead of gconf.

On windows hamster is hiding as StatusIcon on taskbar.

One minor change to UI was made. Instead of GnomeDateEdit, a simple GtkEntry is used in "Add earlier activity" window, because GnomeDateEdit is not available on windows, at least i couldn`t find one.
Comment 7 Toms Bauģis 2009-08-04 19:34:05 UTC
*** Bug 573083 has been marked as a duplicate of this bug. ***
Comment 8 Toms Bauģis 2009-08-04 19:38:09 UTC
Hey Martins!

I totally missed out on your windows port and now I can't figure how I could not notice this bug for so long!

Would it be possible to update the code to correspond to recent trunk and could you maybe upload a patch for investigation?

Having windows port has been a hot topic for quite a while now, so sorry for missing your contribution!
Comment 9 Martins Polakovs 2009-08-04 20:35:00 UTC
Hi Toms,


I'll try my best and update code on next week.
Comment 10 Johannes Hessellund 2009-09-29 08:09:19 UTC
Looking forward to this port.

Forced to use windows at work. And hamster is really missing.
Comment 11 Johannes Hessellund 2009-10-11 10:11:35 UTC
(In reply to comment #9)
> Hi Toms,
> 
> 
> I'll try my best and update code on next week.

How is the work doing ?

I would like to test your hamster windows port.
Are there any gtk-bundle I can install to run hamster-win?

Any posibility you could create a uniformed hamster bundle?
Comment 12 Martins Polakovs 2009-10-12 13:15:29 UTC
Hi,

I have got to the point where i have usable version on windows (still there are things to polish) for current HEAD code.


I'll try to figure out how to better create package for windows and then upload for everyone to try out.
Comment 13 Patryk Zawadzki 2009-10-12 14:06:42 UTC
You might want to check what Gajim crew did:

http://trac.gajim.org/wiki/DevWindows
Comment 14 Martins Polakovs 2009-10-21 15:17:42 UTC
Thanks Patryk for information,

Finally I have created a package. Download from: http://foo.lv/hamster/downloads/hamster-setup-0.1.exe (3MB)

GTK runtime for windows is required in order to run hamster.


Known issues for current windows version:
1. sometimes error message will appear when exiting hamster
2. wrong week range in overview window
3. preferences window is not opening
4. positioning issue. Part of main window is behind windows taskbar.
Comment 15 Toms Bauģis 2009-10-21 15:28:38 UTC
after installation, when trying to launch, program complains on missing libglib-2.0-0.dll  (running win xp in virtualbox).

did a quick google for a gtk+ installer but they all seem to be bundled with other apps
Comment 16 Martins Polakovs 2009-10-21 16:17:23 UTC
here you can finde installer for gtk:
http://sourceforge.net/projects/gtk-win/
Comment 17 Toms Bauģis 2009-10-21 16:28:35 UTC
Cool, thanks!
I wonder, if you could upload a diff file with the changes you had to apply to hamster to make it go under windows? We could try to get those parts in the codebase in an os-agnostic manner.
Comment 18 Martins Polakovs 2009-10-21 17:52:53 UTC
Created attachment 145966 [details] [review]
windows port patch

Attaching the patch.

Windows package was created using "Inno Setup" ( http://www.jrsoftware.org/isinfo.php )

build.bat file in "win" directory automatically executes setup project and creates setup package.
Comment 19 Johannes Hessellund 2009-10-22 06:29:29 UTC
@Martin:

Yes sir! Overall this is just great.

I installed the gtk-bundle 2.16.6, along with python 2.6.2, pygobject, pycairo, pygtk, pysqlite.

"Minor" things are still missing.

* Hotkey not working here. <-- This one is importent.
* Icons missing on preference dialog.
* Preferences not stored ?


Thanks for your great work. I really appreciate this - as will many windows users.

As soon as this windows port is working properly, I will roll out the app at work. (Lot's of lawyers who all need to keep precise track of their time)
Comment 20 Johannes Hessellund 2009-11-12 12:08:12 UTC
Anything new on this topic?
Comment 21 Johannes Hessellund 2009-12-22 12:08:23 UTC
So, any nice christmas presents for windows users?

Really looking forward to this port.
Comment 22 Toms Bauģis 2009-12-22 12:25:28 UTC
If you have not tried out, Martin's port works already.
i have not done anything to integrate the patch yet though.
Comment 23 Johannes Hessellund 2009-12-22 12:49:40 UTC
(In reply to comment #22)
> If you have not tried out, Martin's port works already.
> i have not done anything to integrate the patch yet though.

Yes I did try out Martin's port.

Still a few bugs remaining. Especialy the hotkey is an important feature to get working. See my comment # 19.

Thank you for your work, and merry christmas ;-)
Comment 24 Daniel A. Schilling 2010-05-19 21:38:54 UTC
I would love to help with the Windows version.  I don't have much time, and have almost no Python experience, but I'm a quick learner.

It would be nice to be able to have a more current version of Hamster.  Since Martin posted his wonderful installer, v2.30 has been released.  Maybe we should set up a branch or repository on github where the Windows work can be merged together with the most recent Hamster stuff.  I'd like the ultimate goal to be to add build switches or something so that the windows code could be included in the master branch, but if you guys think that having the windows code in there would slow down the main development too much, then I'm OK with leaving it in its own branch.

On Windows, I think the Gnome applet should be replaced by a deskband rather than a tray icon.  This would mimic the gnome functionality better, allowing the current activity to be constantly visible in the taskbar.  I don't know whether it's possible to implement a deskband with Python.  I found the following documentation which might help:

http://msdn.microsoft.com/en-us/library/cc144099.aspx
http://oreilly.com/catalog/pythonwin32/chapter/ch12.html

I don't know enough about Python and COM to know whether this is possible.  I know you can implement a COM server with Python, but can you implement a specific COM interface (IDeskBand)?  Maybe I should buy Mark Hammond's book.

I give no promises as to whether I'll actually get around to implementing any of this.  I just wanted to share what I was thinking.
Comment 25 Martins Polakovs 2010-05-20 08:24:59 UTC
@Daniel:

Recently I checked hamster's source, to try to update my windows port, but unfortunately much of hamsters code has been changed since the initial port was made. IMO the best way is to start porting from scratch. 

Lately I use Mac OS X as my main desktop, so I have little interest for continuing porting hamster to windows for now. If there was easy way to install PyGTK for Mac, we could join efforts to make hamster portable across all three OS'es, but for now I haven't figured out where/how to get PyGTK packages for Mac
Comment 26 Patryk Zawadzki 2010-05-20 14:41:08 UTC
It would also be easier if scratched one itch at a time, providing small, documented changes as patches so we can incorporate them into the main source tree. Merging a large and possibly outdated chunk of code is hard if not impossible given the pace of refactoring that sometimes happens in git master.
Comment 27 matt wilkie 2010-09-29 20:53:31 UTC
I'm not a developer. Is there anything I can do to help or support hamster development for Windows?
Comment 28 Mark Jones 2010-10-08 14:32:59 UTC
All,
  I have tried to find the site for the windows port, but hte link seems to be bad.  Can someone provide the link?
Comment 29 Matthew 2011-03-11 18:57:26 UTC
I have been ripping out DBUS dependency in the stable release the past few days and have it successfully starting.  However, the GUI does not update when changes are made. For example, when switching tasks, you have to restart the application to see the changes.

It's extremely ugly at the moment but if anyone who knows more about PyGTK would like to take a crack at it, you can download the source at http://howle.org/hamster-applet.zip.  The code is in hamster-applet/src/winhamster/.  Run "python hamster-time-tracker" in that directory.

I am using Python 2.7 on Windows XP SP3. You will need PyGTK here: http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.22/  (the all-in-one includes everything you need; no need to download GTK+, PyObject or PyCairo separately).  I had to download the new DLL of SQLite to support FTS3 (http://sqlite.org/download.html - sqlite-dll-win32).  Backup and then replace C:\Python27\DLLs\sqlite3.dll with the downloaded DLL.

Any help will be appreciated!
Comment 30 Matthew 2011-03-20 05:43:09 UTC
Good news, everyone!  The GUI refreshes on changes and no DBUS dependency.  I will clean up the code tomorrow and if no major bugs appear, I will have the patch and maybe an EXE uploaded soon.
Comment 31 Matthew 2011-03-20 21:05:05 UTC
Created attachment 183866 [details] [review]
Windows Port Patch

Since I had to modify some of the other files, I created a directory called "win32" in hamster-applet as not to break it for non-Windows.  Of course this requires someone to port any changes to it. Hopefully, we can get merge this into the main code where it makes sense.
Comment 32 Matthew 2011-03-20 22:36:59 UTC
Uploaded the files to http://howle.org/winhamster.zip.  If anyone is more proficient at using py2exe or similar tool, please go ahead.  Follow the similar instruction from my comment #29 above except it's in "win32" folder instead of "src/winhamster".
Comment 33 Toms Bauģis 2011-03-21 09:22:57 UTC
Awesome job Mathew - i think we could commit in a separate branch and make use of git's cherry-pick when applicable. Do you by any chance have commit rights into gnome's git? In case if not, follow the instructions here:
http://live.gnome.org/NewAccounts
Comment 34 Toms Bauģis 2011-03-22 13:10:02 UTC
Matthew - feel free to commit your progress to a 'windows' branch or something in the lines!
Comment 35 Matthew 2011-03-25 23:33:27 UTC
I have fixed most of the bugs that have popped up during the port and it is available in the "windows" branch.

Although it definitely not finished yet, I created an installer at http://howle.org/hamster-setup.exe for those interested.  There are a few lingering issues I hope to fix soon but the basic functionality should be there.  

The database is kept in %APPDATA%\hamster-applet\hamster.db.  The replacement for GConf is an INI file (K.I.S.S. :) which is kept in the same path as hamster-time-tracker for now.
Comment 36 Damian 2011-04-08 09:19:49 UTC
Great work, thanks in advance!

I am especially interested in the cumulated overview (per day, per week...).

Matthew, in your opinion:
How difficult will it be to have all functionalites or at least especially the wished one (above)? How long will it take?
Comment 37 Matthew 2011-04-08 19:20:39 UTC
Are you using the hamster-setup.exe from above?  A co-worker just pointed out his overview wasn't working, but it works when running from the source.  I guess py2exe broke something.  I'll try to figure it out and get a new installer built soon.
Comment 38 Damian 2011-04-11 06:39:29 UTC
Thanks for your quick response.

I was using the hamster-setup.exe on clean Vista x32 and Windows 7 x64 virtual machines.

Okay, I will try running it from source. The installer would be the nicest solution.
Comment 39 Matthew 2011-05-02 15:44:24 UTC
I have a new installer at http://howle.org/hamster-setup.exe. 

Overview and other windows seem to work in Windows XP.  There is still an issue with the windows z-ordering (opening Activity->Add New in the Overview window for example).
Comment 40 Luke 2012-02-09 13:31:32 UTC
When trying to download the installer I get the error:

Firefox can't establish a connection to the server at howle.org.

Is this just me? Is there an alternative download site?

Thanks.
Comment 41 Matthew 2012-02-09 14:16:21 UTC
Sorry about that. I'm in the process of rebuilding the server.  It's available now.
Comment 42 Peter Dyson 2012-04-03 14:09:42 UTC
I had a go at compiling the latest Project Hamster source myself on windows:
http://geekpete.com/blog/opensource/project-hamster-windows

I'll post the compile steps I used shortly...let me know if it works...
Comment 43 Toms Bauģis 2012-09-24 18:21:12 UTC
Martins / Matthew - lemme know if you would like to move the code into hamsters github

https://github.com/projecthamster