~toolpart/+junk/pythoncard

« back to all changes in this revision

Viewing changes to samples/moderator/moderator.py

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2010-03-04 23:55:10 UTC
  • mfrom: (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100304235510-3v6lbhzwrgm0pcca
Tags: 0.8.2-1
* QA upload.
* New upstream release
* debian/control
  - set maintainer to QA group
  - set Homepage field, removing the URL from packages description
  - bump versioned b-d-i on python-support, to properly support Python module
  - replace b-d on python-all-dev with python-all, since building only
    arch:all packages
  - replace Source-Version substvar with source:Version
  - add ${misc:Depends} to binary packages Depends
* debian/watch
  - updated to use the SourceForge redirector; thanks to Raphael Geissert for
    the report and to Dario Minnucci for the patch; Closes: #449904
* debian/{pythoncard-doc, python-pythoncard}.install
  - use wildcards instead of site-packages to fix build with python 2.6;
    thanks to Ilya Barygin for the report and patch; Closes: #572332
* debian/pythoncard-doc.doc-base
  - set section to Programmin/Python
* debian/pythoncard-tools.menu
  - set menu main section to Applications
* debian/pythoncard-tools.postinst
  - removed, needed only to update the menu, but it's now created by debhelper

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
"""
4
 
__version__ = "$Revision: 1.8 $"
5
 
__date__ = "$Date: 2004/08/30 14:49:51 $"
 
4
Moderator, as you may have guessed, is a moderation tool. 
 
5
 
 
6
As someone raises their hand to speak, the moderator clicks their name and it goes on the list of people waiting to speak, in order. When someone is speaking, they have a certain number of minutes to speak. It works best when there's a projector, so everyone can see they're on the list and the speaker can see how much time they have left.
 
7
 
 
8
Contributed to the PythonCard community 4/23/2004 by Bruce Eckel
6
9
"""
 
10
__version__ = "$Revision: 1.9 $"
 
11
__date__ = "$Date: 2005/12/13 11:13:23 $"
7
12
 
8
13
import sys
9
14
from PythonCard import dialog, model, timer
17
22
    def on_initialize(self, event):
18
23
        self.clockTimer = timer.Timer(self.components.txtTime, -1)
19
24
        self.clockModel = CountdownClockModel(MAX_TIME)        
20
 
        
21
25
        self.delegates = ModeratorModel()
22
26
        if len(sys.argv) > 1:
23
27
            fname = sys.argv[1]
25
29
            fname = DELEGATE_FILE
26
30
        try:
27
31
            lines = open(fname).readlines()
28
 
        except:
 
32
        except IOError:
29
33
            lines = []
30
 
        
31
 
        
32
34
        for delegate in lines:
33
35
            if delegate.strip():
34
36
                self.delegates.add(delegate.strip())            
35
 
            
36
37
        self.update()
37
38
 
38
39
    def on_close(self, event):
94
95
            self.delegates.add(text.strip())
95
96
            self.update()
96
97
 
97
 
 
98
98
class CountdownClockModel:
99
99
    def __init__(self, max):
100
100
        assert max > 0