[Workman-svn] SF.net SVN: workman:[34] trunk/src/workman_types.py
An unobtrusive time-tracking program for self-employed people
Status: Pre-Alpha
Brought to you by:
jmsilva
|
From: <jm...@us...> - 2011-10-21 00:52:00
|
Revision: 34
http://workman.svn.sourceforge.net/workman/?rev=34&view=rev
Author: jmsilva
Date: 2011-10-21 00:51:54 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
Python apparently already had a types module
Added Paths:
-----------
trunk/src/workman_types.py
Added: trunk/src/workman_types.py
===================================================================
--- trunk/src/workman_types.py (rev 0)
+++ trunk/src/workman_types.py 2011-10-21 00:51:54 UTC (rev 34)
@@ -0,0 +1,89 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Workman - A time tracking program for self-employed people
+# Copyright (C) 2009 João Miguel Ferreira da Silva
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+'''
+
+Created on 2009/12/08
+
+@author: João Miguel Ferreira da Silva
+'''
+
+from datetime import datetime
+
+class Employer:
+ '''
+ Specifies an employer
+ '''
+ def __init__(self, name = '', rate = 0.0,
+ description = '', projects = None):
+ self.name = name
+ self.rate = rate
+ self.description = description
+ if projects is None:
+ self.projects = {}
+ else:
+ self.projects = projects
+
+
+class Project:
+ def __init__(self, name = '', employer = None, description = '', sessions = None):
+ self.name = name
+ self.description = description
+ self.setEmployer(employer)
+ if sessions is None:
+ self.sessions = []
+ else:
+ self.sessions = sessions
+
+
+ def setEmployer(self, employer):
+ self.employer = employer
+ if employer is not None:
+ employer.projects[self.name] = self
+
+class Session:
+ def __init__(self, project = None, startTime = datetime.now(),
+ endTime = None, message = '', breaks = None):
+ self.startTime = startTime
+ self.endTime = endTime
+ self.setProject(project)
+ if breaks is not None:
+ self.breaks = []
+ else:
+ self.breaks = breaks
+
+ def setProject(self, project):
+ self.project = project
+ if project is not None:
+ project.sessions.append(self)
+
+
+class Break:
+
+ def __init__(self, session = None, startTime = datetime.now(),
+ endTime = None, reason = ''):
+ self.startTime = startTime
+ self.endTime = endTime
+ self.reason = reason
+ self.setSession(session)
+
+ def setSession(self, session):
+ self.session = session
+ if session is not None:
+ session.breaks.append(self)
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|