rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
title=u"The object this facet is augmenting"
title=u"The object this facet is augmenting",
def __call__(self, event): """Invoke the callback."""
template = Template("www/timetable.pt", content_type="text/xml; charset=UTF-8") def title(self): timetabled = self.context.__parent__.__parent__ return _("%s's complete timetable for %s") % (timetabled.title, ", ".join(self.key))
template = Template("www/timetable.pt", content_type="text/xml; charset=UTF-8")
def parseDuration(duration_str): """Parse a duration string and return a datetime.timedelta. >>> parseDuration('1') datetime.timedelta(0, 60) >>> parseDuration('just a minute') Traceback (most recent call last): ... RestError: Invalid duration: just a minute >>> parseDuration('0') Traceback (most recent call last): .....
XXX there are reentrancy problems -- hold down Alt-R and watch. it looks like wxWindows can call DoRefresh while another "thread" is still inside DoRefresh """
""" if not self.refresh_lock.acquire(False): return try: self._refresh() finally: self.refresh_lock.release() def _refresh(self):
def DoRefresh(self, event=None): """Refresh data from the server.
self.groupTreeCtrl.SelectItem(item)
def DoRefresh(self, event=None): """Refresh data from the server.
from zope.app.form.browser import PasswordWidget, TextWidget, BytesWidget from zope.app.form.browser import CheckBoxWidget, DateWidget, IntWidget from zope.app.form.browser import ChoiceInputWidget, DropdownWidget, TextAreaWidget from zope.app.form.browser import ChoiceCollectionInputWidget, CollectionInputWidget from ...
def setUp(test): """Set up the test fixture for doctests in this module. Performs what is called a "placeless setup" in the Zope 3 world, then sets up annotations, relationships, and registers widgets as views for some schema fields. """ from zope.app.form.browser import PasswordWidget, TextWidget, BytesWidget from zo...
from zope.schema.interfaces import IPassword, ITextLine, IText, IBytes, IBool, ISet from zope.schema.interfaces import IDate, IInt, IChoice, IIterableVocabulary
from zope.schema.interfaces import \ IPassword, ITextLine, IText, IBytes, IBool, ISet, IList, IDate, \ IInt, IChoice, IIterableVocabulary, IVocabularyTokenized, \ ICollection from zope.app.form.browser import \ PasswordWidget, TextWidget, BytesWidget, CheckBoxWidget, \ DateWidget, IntWidget, ChoiceInputWidget, Dropdown...
def setUp(test): """Set up the test fixture for doctests in this module. Performs what is called a "placeless setup" in the Zope 3 world, then sets up annotations, relationships, and registers widgets as views for some schema fields. """ from zope.app.form.browser import PasswordWidget, TextWidget, BytesWidget from zo...
ztapi.browserViewProviding(ISet, CollectionInputWidget, IInputWidget)
ztapi.browserViewProviding(ICollection, CollectionInputWidget, IInputWidget)
def setUp(test): """Set up the test fixture for doctests in this module. Performs what is called a "placeless setup" in the Zope 3 world, then sets up annotations, relationships, and registers widgets as views for some schema fields. """ from zope.app.form.browser import PasswordWidget, TextWidget, BytesWidget from zo...
result += [ "DTSTART:%s" % ical_datetime(event.dtstart), "DURATION:%s" % ical_duration(event.duration), "DTSTAMP:%s" % dtstamp, "END:VEVENT", ]
if event.allday: dtstart = 'DTSTART;VALUE=DATE:%s' % ical_date(event.dtstart) else: dtstart = 'DTSTART:%s' % ical_datetime(event.dtstart) result += [dtstart, "DURATION:%s" % ical_duration(event.duration), "DTSTAMP:%s" % dtstamp, "END:VEVENT"]
def convert_event_to_ical(event): r"""Convert an ICalendarEvent to iCalendar VEVENT component. Returns a list of strings (without newlines) in UTF-8. >>> from datetime import datetime, timedelta >>> event = SimpleCalendarEvent(datetime(2004, 12, 16, 10, 7, 29), ... timedelta(hours=1), "iCa...
title=u"Repeat every",
title=_("Repeat every"),
def __init__(self, context, request): self.context = context self.request = request
request.setPrincipal(self.person)
principal = Principal('person', 'Some person', person=self.person) request.setPrincipal(principal)
def test_calendarRows(self): from schooltool.browser.cal import DailyCalendarView
request.setPrincipal(self.person)
principal = Principal('person', 'Some person', person=self.person) request.setPrincipal(principal)
def test_calendarRows_no_periods(self): from schooltool.browser.cal import DailyCalendarView from schooltool.app import getPersonPreferences
def breadcrumbs(self): return []
def listBreadcrumbs(self): if not hasattr(self, 'breadcrumbs'): return [] return [{'url': url, 'title': title} for title, url in self.breadcrumbs()]
def breadcrumbs(self): return []
return object.label
return removeSecurityProxy(object.label)
def getTitleOrLabel(item): object = item.calendar.__parent__ if ISection.providedBy(object): return object.label else: return item.calendar.title
('datafile-dir=', None, "override where schooltool thinks its " "data files are")]
('datafile-dir=', None, "override where the python libraries think" " their data files are")]
def run(self): """Record where we have installed the data files""" # we have to make sure the build directory is around self.run_command('build') # write where we have installed the data files to build/data_base try: data_file = open(os.path.join(self.build_base, self.package + '_data_base'), 'w') data_file.write(os.pa...
print self.datafile_dir
def update_pathconfig(self): # Write the new location to the pathconfig.py file. pathconfig = os.path.join(self.build_lib, self.package, 'pathconfig.py') if self.datafile_dir is None: # Make sure that we have installed the data files self.run_command('install_data') # Get the location of the installed data try: data_fi...
class TestUriObjectListView(NiceDiffsMixin, unittest.TestCase):
class TestUriObjectListView(NiceDiffsMixin, XMLCompareMixin, RegistriesSetupMixin, unittest.TestCase):
def testErrors(self): request = RequestStub('/availability', method="GET") result = self.view.render(request) self.assertEquals(request.code, 400) self.assertEquals(result, "'first' argument must be provided")
from schooltool.uris import URIObject, registerURI
from schooltool.uris import URIObject, registerURI, resetURIRegistry self.setUpRegistries()
def setUp(self): from schooltool.rest.app import UriObjectListView from schooltool.app import Application from schooltool.uris import URIObject, registerURI URI1 = URIObject("http://example.com/foobar", name="da name", description="A long\ndescription") URI2 = URIObject("http://example.com/foo", name="da name", descrip...
self.assertEquals(result, dedent("""
self.assertEqualsXML(result, dedent("""
def test_render(self): request = RequestStub("http://localhost/uris") result = self.view.render(request) self.assertEquals(result, dedent(""" <uriobjects> <uriobject uri="http://example.com/foobar"> <name>da name</name> <description>A long description</description> </uriobject> <uriobject uri="http://example.com/foo"> ...
directlyProvides(result, ILocation)
def makeTimetableCalendar(self): events = [] timePeriodService = getTimePeriodService(self) for period_id, schema_id in self.listCompositeTimetables(): schoolday_model = timePeriodService[period_id] tt = self.getCompositeTimetable(period_id, schema_id) cal = tt.model.createCalendar(schoolday_model, tt) events += list(c...
for entry in super(ClassMenu, self).findClasses():
for entry in super(CodeMenu, self).findClasses():
def findClasses(self): for entry in super(ClassMenu, self).findClasses(): if 'schoolbell' not in entry['path']: continue entry['path'] = entry['path'].replace('schoolbell', 'sb') yield entry
suite = unittest.TestSuite()
def test_suite(): suite = unittest.TestSuite() optionflags = (doctest.ELLIPSIS | doctest.REPORT_NDIFF | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE) suite.addTest(doctest.DocTestSuite(setUp=setUp, tearDown=tearDown, optionflags=optionflags)) module_name = 'schooltool.timetable.browser.ttwizard' sui...
suite.addTest(doctest.DocTestSuite(setUp=setUp, tearDown=tearDown, optionflags=optionflags)) module_name = 'schooltool.timetable.browser.ttwizard' suite.addTest(doctest.DocTestSuite(module_name, optionflags=optionflags)) return suite
return unittest.TestSuite([ doctest.DocTestSuite(setUp=setUp, tearDown=tearDown, optionflags=optionflags), doctest.DocTestSuite('schooltool.timetable.browser.ttwizard', optionflags=optionflags), ])
def test_suite(): suite = unittest.TestSuite() optionflags = (doctest.ELLIPSIS | doctest.REPORT_NDIFF | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE) suite.addTest(doctest.DocTestSuite(setUp=setUp, tearDown=tearDown, optionflags=optionflags)) module_name = 'schooltool.timetable.browser.ttwizard' sui...
context = xmlconfig.string(SITE_DEFINITION)
xmlconfig.string(SITE_DEFINITION)
def configure(): """Configure Zope 3 components.""" # Hook up custom component architecture calls zope.app.component.hooks.setHooks() context = xmlconfig.string(SITE_DEFINITION)
if (user and removeSecurityProxy(self.context) is removeSecurityProxy(user.calendar)):
if user is None: return unproxied_context = removeSecurityProxy(self.context) unproxied_calendar = removeSecurityProxy(user.calendar) if unproxied_context is unproxied_calendar:
def getCalendars(self): """Get a list of calendars to display.
10:00: [Math, History] [none]
10:00: [History, Math] [none]
>>> def printDays(days):
10:00: [Math, History] [Math]
10:00: [History, Math] [Math]
>>> def printDays(days):
pdfURL generates links to PDFs. It should only be called on subclasses which have cal_type set, so we will temporarily do that.
pdfURL generates links to PDFs. It only works when calendar generation is enabled: >>> from schoolbell.app.browser import pdfcal >>> real_pdfcal_disabled = pdfcal.disabled >>> pdfcal.disabled = True >>> print view.pdfURL() None >>> pdfcal.disabled = False It should only be called on subclasses which have cal_type ...
def doctest_CalendarViewBase(): """Tests for CalendarViewBase. >>> setUpSessions() >>> from schoolbell.app.browser.cal import CalendarViewBase >>> from schoolbell.app.cal import Calendar >>> calendar = Calendar() >>> directlyProvides(calendar, IContainmentRoot) Set up the checkers for canEdit/canView on events: >>>...
user = request.authenticated_user
user = self.request.authenticated_user
def canEdit(self): # XXX this is slightly bogus # who can add timetable exceptions? # that is a deep question! # a timetable is shared through composition! user = request.authenticated_user return isManager(user)
This is a doctest version of schoolbell.app.rest.tests.utils.asserEqualsXML If recursively_sort is given, it is a sequence of tags that will have test:sort="recursively" appended to their attribute lists in 'result' text. See the docstring for normalize_xml for more information about this attribute. """
This is a doctest version of XMLCompareMixin.assertEqualsXML from schoolbell.app.rest.tests.utils. If recursively_sort is given, it is a sequence of tags that will have test:sort="recursively" appended to their attribute lists in 'result' text. See the docstring for normalize_xml for more information about this attrib...
def compareXML(result, expected, recursively_sort=()): """Compare 2 XML snippets for equality. This is a doctest version of schoolbell.app.rest.tests.utils.asserEqualsXML If recursively_sort is given, it is a sequence of tags that will have test:sort="recursively" appended to their attribute lists in 'result' text. S...
print diff(expected, result) raise ValueError("Unexpected Results.")
print diff(expected, result) return False
def compareXML(result, expected, recursively_sort=()): """Compare 2 XML snippets for equality. This is a doctest version of schoolbell.app.rest.tests.utils.asserEqualsXML If recursively_sort is given, it is a sequence of tags that will have test:sort="recursively" appended to their attribute lists in 'result' text. S...
"""Iterates over (title, start, duration) of time slots that make up
"""Iterate over (title, start, duration) of time slots that make up
def calendarRows(self): """Iterates over (title, start, duration) of time slots that make up the daily calendar. """ person = IPerson(self.request.principal, None) if person is not None: prefs = IPersonPreferences(person) show_periods = prefs.cal_periods else: show_periods = False
"""A sample data plugin that generates students
"""A sample data plugin that generates a timetable schema
def doctest_SampleTimetableSchema(): """A sample data plugin that generates students >>> from schooltool.timetable.sampledata import SampleTimetableSchema >>> from schooltool.sampledata.interfaces import ISampleDataPlugin >>> plugin = SampleTimetableSchema() >>> verifyObject(ISampleDataPlugin, plugin) True >>> app = ...
days = self.getSessionData()['day_names'] self.getSessionData()['periods_order'] = [result for day in days]
day_names = self.getSessionData()['day_names'] self.getSessionData()['periods_order'] = [result] * len(day_names)
def update(self): result = [] periods = self.getSessionData()['period_names'] for i in range(self.numPeriods()): name = 'period_%d' % i if name not in self.request: self.error = _('Please provide all periods.') return False result.append(self.request[name])
if line.startswith('>>>>>>'): total += 1 try: passes = int(line.split(":")[0]) total += 1
if line.startswith(' '*7) or len(line) < 7: continue total += 1 if not line.startswith('>>>>>>'):
def parse_file(filename): """Parse a plain-text coverage report and return (covered, total).""" covered = 0 total = 0 for line in file(filename): if line.startswith('>>>>>>'): total += 1 try: passes = int(line.split(":")[0]) total += 1 covered += 1 except: pass return (covered, total)
except: pass
def parse_file(filename): """Parse a plain-text coverage report and return (covered, total).""" covered = 0 total = 0 for line in file(filename): if line.startswith('>>>>>>'): total += 1 try: passes = int(line.split(":")[0]) total += 1 covered += 1 except: pass return (covered, total)
real_response = RealResponseStub()
real_response = self.RealResponseStub()
def test(self): from schooltool.restclient.restclient import Response real_response = RealResponseStub() response = Response(real_response) self.assertEquals(response.status, real_response.status) self.assertEquals(response.reason, real_response.reason) self.assertEquals(response.body, '<body/>') self.assertEquals(resp...
if name.startswith('zope'): continue
def listContentClasses(self): # Make sure that the class registry is setup. self.context.get('')
info.update(utilities.getPermissionIds( 'PUT', checker=reg.value.checker))
checker = getattr(reg.value, 'checker', None) if checker: info.update(utilities.getPermissionIds('PUT', checker=checker))
def getPUTInfo(self): """Get the info dictionary of the PUT RESTive view.
schema = getattr(reg.value.factory, 'schema', None)
schema = getattr(factory, 'schema', None)
def getPUTInfo(self): """Get the info dictionary of the PUT RESTive view.
info.update(utilities.getPermissionIds( 'DELETE', checker=reg.value.checker))
checker = getattr(reg.value, 'checker', None) if checker: info.update(utilities.getPermissionIds('DELETE', checker=checker))
def getDELETEInfo(self): """Get the info dictionary of the DELETE RESTive view.
raise RestError('Principal "%s" unklown' % principalid)
raise RestError('Principal "%s" unknown' % principalid)
def parseData(self, body): """Extract the data and validates it.
'notes': _('Notes')}
'notes': _('Notes'), 'addresses': _('Addresses')}
def breadcrumbs(self): if self.context is not None: app = traverse(self.context, '/') return [(_('Start'), absoluteURL(self.request, app, 'start'))] else: return []
if self.__parent__ in event.resources:
unproxied_resources = [removeSecurityProxy(resource) for resource in event.resources] if self.__parent__ in unproxied_resources:
def removeEvent(self, event): if self.__parent__ in event.resources: event.unbookResource(self.__parent__) else: del self.events[event.unique_id] if self is event.__parent__: event.__parent__ = None for resource in event.resources: event.unbookResource(resource)
if self is event.__parent__: event.__parent__ = None
parent_calendar = removeSecurityProxy(event.__parent__) if self is parent_calendar:
def removeEvent(self, event): if self.__parent__ in event.resources: event.unbookResource(self.__parent__) else: del self.events[event.unique_id] if self is event.__parent__: event.__parent__ = None for resource in event.resources: event.unbookResource(resource)
self.__super_startTest(test) self.testsRun = n
def startTest(self, test): n = self.testsRun + test.countTestCases() self.__super_startTest(test) # increments testsRun by one self.testsRun = n # override the testsRun calculation if self.cfg.progress: # verbosity == 0: 'xxxx/xxxx (xxx.x%)' # verbosity == 1: 'xxxx/xxxx (xxx.x%): test name' # verbosity >= 2: 'xxxx/xxx...
"""Returns a function that takes one argument and returns True or False.
"""Return a function that takes one argument and returns True or False.
def compile_matcher(regex): """Returns a function that takes one argument and returns True or False. Regex is a regular expression. Empty regex matches everything. There is one expression: if the regex starts with "!", the meaning of it is reversed. """ if not regex: return lambda x: True elif regex == '!': return l...
setUpEditWidgets(self, IPersonEditForm, self.context)
setUpWidgets(self, IPersonEditForm, IInputWidget, initial={'title': self.context.title, 'photo': self.context.photo})
def __init__(self, context, request): BrowserView.__init__(self, context, request) setUpEditWidgets(self, IPersonEditForm, self.context)
>>> from schooltool.app.app import ApplicationPreferences
>>> setup.setUpAnnotations()
def doctest_SchoolToolApplication(): """SchoolToolApplication We need to register an adapter to make the title attribute available: >>> placelesssetup.setUp() >>> from schooltool.app.app import ApplicationPreferences >>> from schooltool.app.interfaces import ISchoolToolApplication >>> from schooltool.app.interfaces i...
>>> provideAdapter(ApplicationPreferences,
>>> from schooltool.app.app import getApplicationPreferences >>> provideAdapter(getApplicationPreferences,
def doctest_SchoolToolApplication(): """SchoolToolApplication We need to register an adapter to make the title attribute available: >>> placelesssetup.setUp() >>> from schooltool.app.app import ApplicationPreferences >>> from schooltool.app.interfaces import ISchoolToolApplication >>> from schooltool.app.interfaces i...
>>> setup.setUpAnnotations()
def doctest_SchoolToolApplication(): """SchoolToolApplication We need to register an adapter to make the title attribute available: >>> placelesssetup.setUp() >>> from schooltool.app.app import ApplicationPreferences >>> from schooltool.app.interfaces import ISchoolToolApplication >>> from schooltool.app.interfaces i...
xmlns:browser="http://namespaces.zope.org/browser">
xmlns:browser="http://namespaces.zope.org/browser" i18n_domain="schoolbell">
def daemonize(): """Daemonize with a double fork and close the standard IO.""" pid = os.fork() if pid: sys.exit(0) os.setsid() os.umask(077) pid = os.fork() if pid: print _("Going to background, daemon pid %d" % pid) sys.exit(0) os.close(0) os.close(1) os.close(2) os.open('/dev/null', os.O_RDWR) os.dup(0) os.dup(0)
<unauthenticatedPrincipal id="zope.anybody" title="%(unauth_user)s" /> <unauthenticatedGroup id="zope.Anybody" title="%(unauth_users)s" /> <authenticatedGroup id="zope.Authenticated" title="%(auth_users)s" /> <everybodyGroup id="zope.Everybody" title="%(all_users)s" />
<unauthenticatedPrincipal id="zope.anybody" title="Unauthenticated User" /> <unauthenticatedGroup id="zope.Anybody" title="Unauthenticated Users" /> <authenticatedGroup id="zope.Authenticated" title="Authenticated Users" /> <everybodyGroup id="zope.Everybody" title="All Users" />
def daemonize(): """Daemonize with a double fork and close the standard IO.""" pid = os.fork() if pid: sys.exit(0) os.setsid() os.umask(077) pid = os.fork() if pid: print _("Going to background, daemon pid %d" % pid) sys.exit(0) os.close(0) os.close(1) os.close(2) os.open('/dev/null', os.O_RDWR) os.dup(0) os.dup(0)
""" % {'unauth_user': catalog.ugettext("Unauthenticated User"), 'unauth_users': catalog.ugettext("Unauthenticated Users"), 'auth_users': catalog.ugettext("Authenticated Users"), 'all_users': catalog.ugettext("All Users")}
"""
def daemonize(): """Daemonize with a double fork and close the standard IO.""" pid = os.fork() if pid: sys.exit(0) os.setsid() os.umask(077) pid = os.fork() if pid: print _("Going to background, daemon pid %d" % pid) sys.exit(0) os.close(0) os.close(1) os.close(2) os.open('/dev/null', os.O_RDWR) os.dup(0) os.dup(0)
if 'SEARCH' in self.request:
if 'SEARCH' in self.request and 'CLEAR_SEARCH' not in self.request:
def update(self): # This method is rather similar to GroupListView.update(). context_url = zapi.absoluteURL(self.context, self.request) context_instructors = removeSecurityProxy(self.context.instructors) if 'ADD_INSTRUCTORS' in self.request: for instructor in self.getPotentialInstructors(): if 'add_instructor.' + instr...
maker = extract.POTMaker(output_file, path)
maker = POTMaker(output_file, path)
def build_pot(): """Build the *.pot.""" # where is eveything here = os.path.abspath(os.path.dirname(__file__)) domain = 'schoolbell' path = os.path.join(here, 'src') output_dir = os.path.join(here, 'src', 'schoolbell', 'app', 'locales') base_dir = os.path.join(here, 'src', 'schoolbell') # Setup (zcml, zcml_filename) =...
manager = removeSecurityProxy(manager)
def POST(self): settings = self.parseData(self.request.bodyFile.read()) manager = IPrincipalPermissionManager(self.context) # XXX: alga: the view permission checking does not work! # I'll rely on the IPrincipalPermissionManager security for now. # # this view is protected by schooltool.controlAccess # manager = removeS...
return _("Permissions updated")
return unicode(_("Permissions updated"))
def POST(self): settings = self.parseData(self.request.bodyFile.read()) manager = IPrincipalPermissionManager(self.context) # XXX: alga: the view permission checking does not work! # I'll rely on the IPrincipalPermissionManager security for now. # # this view is protected by schooltool.controlAccess # manager = removeS...
def setupPopupMenu(control, menu): def mouse_handler(event): control.PopupMenu(menu, event.GetPosition()) def handler(event): pos = control.ScreenToClient(wxGetMousePosition()) control.PopupMenu(menu, pos) EVT_RIGHT_UP(control, mouse_handler) EVT_COMMAND_RIGHT_CLICK(control, control.GetId(), handler) if isinstance(c...
def setupPopupMenu(control, menu):
EVT_RIGHT_DOWN(self.groupTreeCtrl, self.DoTreeRightDown)
def handler(event): pos = control.ScreenToClient(wxGetMousePosition()) control.PopupMenu(menu, pos)
EVT_RIGHT_DOWN(self.personListCtrl, self.DoPersonRightDown)
def handler(event): pos = control.ScreenToClient(wxGetMousePosition()) control.PopupMenu(menu, pos)
EVT_RIGHT_DOWN(self.relationshipListCtrl, self.DoRelationshipRightDown)
def handler(event): pos = control.ScreenToClient(wxGetMousePosition()) control.PopupMenu(menu, pos)
def DoTreeRightDown(self, event): """Select the group under mouse cursor. Called when the right mouse buton is pressed on the group tree control. """ item, flags = self.groupTreeCtrl.HitTest(event.GetPosition()) if item.IsOk(): self.groupTreeCtrl.SelectItem(item) event.Skip() def DoPersonRightDown(self, event): """Se...
def DoSelectGroup(self, event): """Update member and relationship lists for the selected group.
<html>
def doctest_ACLView(): r""" Set up for local grants: >>> from zope.app.annotation.interfaces import IAnnotatable >>> from zope.app.securitypolicy.interfaces import \ ... IPrincipalPermissionManager >>> from zope.app.securitypolicy.principalpermission import \ ... Annotat...
return from_locale(self.serverTextCtrl.GetValue())
return from_wx(self.serverTextCtrl.GetValue())
def getServer(self): return from_locale(self.serverTextCtrl.GetValue())
self.serverTextCtrl.SetValue(to_locale(value))
self.serverTextCtrl.SetValue(to_wx(value))
def setServer(self, value): self.serverTextCtrl.SetValue(to_locale(value))
return from_locale(self.userTextCtrl.GetValue())
return from_wx(self.userTextCtrl.GetValue())
def getUser(self): return from_locale(self.userTextCtrl.GetValue())
self.userTextCtrl.SetValue(to_locale(value))
self.userTextCtrl.SetValue(to_wx(value))
def setUser(self, value): self.userTextCtrl.SetValue(to_locale(value))
return from_locale(self.passwordTextCtrl.GetValue())
return from_wx(self.passwordTextCtrl.GetValue())
def getPassword(self): return from_locale(self.passwordTextCtrl.GetValue())
self.passwordTextCtrl.SetValue(to_locale(value))
self.passwordTextCtrl.SetValue(to_wx(value))
def setPassword(self, value): self.passwordTextCtrl.SetValue(to_locale(value))
title = to_locale(title)
title = to_wx(title)
def __init__(self, parent, title, show_resolved): title = to_locale(title) wxDialog.__init__(self, parent, -1, title, style=DEFAULT_DLG_STYLE) self.show_resolved = show_resolved
self.text_ctrl.SetValue(to_locale(comment))
self.text_ctrl.SetValue(to_wx(comment))
def setComment(self, comment): if comment is None: self.text_ctrl.SetValue("") else: self.text_ctrl.SetValue(to_locale(comment))
return from_locale(self.text_ctrl.GetValue())
return from_wx(self.text_ctrl.GetValue())
def getComment(self): return from_locale(self.text_ctrl.GetValue())
title = _("Roll Call for %s") % to_locale(group_title)
title = _("Roll Call for %s") % to_wx(group_title)
def __init__(self, parent, group_title, group_path, rollcall, client): title = _("Roll Call for %s") % to_locale(group_title) wxDialog.__init__(self, parent, -1, title, style=RESIZABLE_DLG_STYLE) self.title = title self.group_title = group_title self.group_path = group_path self.client = client
to_locale(item.person_title)),
to_wx(item.person_title)),
def __init__(self, parent, group_title, group_path, rollcall, client): title = _("Roll Call for %s") % to_locale(group_title) wxDialog.__init__(self, parent, -1, title, style=RESIZABLE_DLG_STYLE) self.title = title self.group_title = group_title self.group_path = group_path self.client = client
to_locale(absence.person_title))
to_wx(absence.person_title))
def DoRefresh(self, event=None, data=None): """Refresh the absence list.""" self.absence_list.DeleteAllItems() self.absence_data = [] self.comment_list.DeleteAllItems() self.comment_data = [] if data is not None: self.absence_data = data else: try: self.absence_data = self.client.getAbsences(self.path) except SchoolToo...
to_locale(absence.last_comment))
to_wx(absence.last_comment))
def DoRefresh(self, event=None, data=None): """Refresh the absence list.""" self.absence_list.DeleteAllItems() self.absence_data = [] self.comment_list.DeleteAllItems() self.comment_data = [] if data is not None: self.absence_data = data else: try: self.absence_data = self.client.getAbsences(self.path) except SchoolToo...
to_locale(unicode(absence)))
to_wx(unicode(absence)))
def DoRefresh(self, event=None, data=None): """Refresh the absence list.""" self.absence_list.DeleteAllItems() self.absence_data = [] self.comment_list.DeleteAllItems() self.comment_data = [] if data is not None: self.absence_data = data else: try: self.absence_data = self.client.getAbsences(self.path) except SchoolToo...
to_locale(comment.reporter_title))
to_wx(comment.reporter_title))
def DoSelectAbsence(self, event): """Refresh the absence comment list.""" self.comment_list.DeleteAllItems() self.comment_data = []
to_locale(comment.absent_from_title))
to_wx(comment.absent_from_title))
def DoSelectAbsence(self, event): """Refresh the absence comment list.""" self.comment_list.DeleteAllItems() self.comment_data = []
self.comment_list.SetStringItem(idx, 6, to_locale(comment.text))
self.comment_list.SetStringItem(idx, 6, to_wx(comment.text))
def DoSelectAbsence(self, event): """Refresh the absence comment list.""" self.comment_list.DeleteAllItems() self.comment_data = []
return "%s, %s" % tuple(map(to_locale, self.tt.periods[col]))
return "%s, %s" % tuple(map(to_wx, self.tt.periods[col]))
def GetColLabelValue(self, col): return "%s, %s" % tuple(map(to_locale, self.tt.periods[col]))
return to_locale(self.tt.teachers[row][1])
return to_wx(self.tt.teachers[row][1])
def GetRowLabelValue(self, row): return to_locale(self.tt.teachers[row][1])
return to_locale(",\n".join(rows))
return to_wx(",\n".join(rows))
def GetValue(self, row, col): rows = [] for title, path, resources in self.tt.tt[row][col]: if resources: resource_titles = [rtitle for rtitle, rpath in resources] resource_titles.sort() rows.append("%s (%s)" % (title, ', '.join(resource_titles))) else: rows.append(title) rows.sort() return to_locale(",\n".join(rows))
(to_locale(period_key[0]), to_locale(period_key[1]), to_locale(teacher_title), to_locale(activity_title)))
(to_wx(period_key[0]), to_wx(period_key[1]), to_wx(teacher_title), to_wx(activity_title)))
def __init__(self, parent, activity_title, teacher_title, period_key, choices): title = _("Resource Assignment") wxDialog.__init__(self, parent, -1, title, style=DEFAULT_DLG_STYLE)
choices=[to_locale(title)
choices=[to_wx(title)
def __init__(self, parent, activity_title, teacher_title, period_key, choices): title = _("Resource Assignment") wxDialog.__init__(self, parent, -1, title, style=DEFAULT_DLG_STYLE)
(to_locale(period_key[0]), to_locale(period_key[1]), to_locale(teacher_title)))
(to_wx(period_key[0]), to_wx(period_key[1]), to_wx(teacher_title)))
def __init__(self, parent, teacher_title, period_key, choices, resources): title = _("Activity Selection") wxDialog.__init__(self, parent, -1, title, style=DEFAULT_DLG_STYLE)
self.listbox = wxCheckListBox(self, -1, choices=[to_locale(c[0])
self.listbox = wxCheckListBox(self, -1, choices=[to_wx(c[0])
def __init__(self, parent, teacher_title, period_key, choices, resources): title = _("Activity Selection") wxDialog.__init__(self, parent, -1, title, style=DEFAULT_DLG_STYLE)
self.listbox.SetString(idx, to_locale(title))
self.listbox.SetString(idx, to_wx(title))
def DoAssignResources(self, idx): title, path, resources = self.choices[idx] dlg = ResourceSelectionDlg(self, title, self.teacher_title, self.period_key, self.resources) dlg.setSelection(resources) if dlg.ShowModal() == wxID_OK: # Important: in-place modification of self.choices resources[:] = dlg.getSelection() resour...
self.listbox.SetString(idx, to_locale(title))
self.listbox.SetString(idx, to_wx(title))
def setSelection(self, selection): selected = {} for title, path, resources in selection: selected[path] = resources for idx, (title, path, resources) in enumerate(self.choices): is_selected = path in selected if is_selected: # Important: in-place modification of self.choices resources[:] = selected[path] resources.sor...
name = from_locale(self.nameTextCtrl.GetValue()) username = from_locale(self.userTextCtrl.GetValue()) password = from_locale(self.passwdTextCtrl.GetValue())
name = from_wx(self.nameTextCtrl.GetValue()) username = from_wx(self.userTextCtrl.GetValue()) password = from_wx(self.passwdTextCtrl.GetValue())
def OnOk(self, event): """Verify that all data is entered before closing the dialog.""" if self.passwdTextCtrl.GetValue() != self.passwd2TextCtrl.GetValue(): wxMessageBox(_("Passwords do not match"), self.title, wxICON_ERROR|wxOK) return name = from_locale(self.nameTextCtrl.GetValue()) username = from_locale(self.userT...
title = _("School Timetable (%s, %s)") % tuple(map(to_locale, key))
title = _("School Timetable (%s, %s)") % tuple(map(to_wx, key))
def __init__(self, client, key, tt, resources, parent=None, id=-1): title = _("School Timetable (%s, %s)") % tuple(map(to_locale, key)) wxDialog.__init__(self, parent, id, title, size=wxSize(600, 400), style=RESIZABLE_WIN_STYLE) self.title = title self.client = client self.key = key self.tt = tt
choices=[to_locale(r[0])
choices=[to_wx(r[0])
def __init__(self, client, parent=None, id=-1): title = _("Search for Available Resources") wxDialog.__init__(self, parent, id, title, size=wxSize(600, 400), style=RESIZABLE_WIN_STYLE) self.client = client self.title = title self.ok = False
self.result_list.InsertStringItem(idx, to_locale(slot.resource_title))
self.result_list.InsertStringItem(idx, to_wx(slot.resource_title))
def OnFind(self, event=None): """Find available resources.""" try: ctrl = self.first_date_ctrl first = parse_date(ctrl.GetValue()) ctrl = self.last_date_ctrl last = parse_date(ctrl.GetValue()) ctrl = self.duration_ctrl duration = int(ctrl.GetValue()) except ValueError: ctrl.SetFocus() wxBell() return hours = self.hour_...
choices=[to_locale(r[0])
choices=[to_wx(r[0])
def __init__(self, parent, client, resources, duration="30"): title = _("Resource Booking") wxDialog.__init__(self, parent, -1, title, style=NONMODAL_DLG_STYLE) self.title = title self.client = client self.resources = resources self.ok = False try: self.persons = self.client.getListOfPersons() except SchoolToolError, e...
choices=[to_locale(p[0])
choices=[to_wx(p[0])
def __init__(self, parent, client, resources, duration="30"): title = _("Resource Booking") wxDialog.__init__(self, parent, -1, title, style=NONMODAL_DLG_STYLE) self.title = title self.client = client self.resources = resources self.ok = False try: self.persons = self.client.getListOfPersons() except SchoolToolError, e...
self.title = (_("Change Password for %s") % to_locale(person.person_title))
self.title = _("Change Password for %s") % to_wx(person.person_title)
def __init__(self, parent, client, person): self.title = (_("Change Password for %s") % to_locale(person.person_title)) self.username = person.person_path.split('/')[-1] self.client = client wxDialog.__init__(self, parent, -1, self.title, style=NONMODAL_DLG_STYLE)
vsizer.Add(wxStaticText(self, -1, to_locale(person.person_title)),
vsizer.Add(wxStaticText(self, -1, to_wx(person.person_title)),
def __init__(self, parent, client, person): self.title = (_("Change Password for %s") % to_locale(person.person_title)) self.username = person.person_path.split('/')[-1] self.client = client wxDialog.__init__(self, parent, -1, self.title, style=NONMODAL_DLG_STYLE)
% to_locale(self.username)),
% to_wx(self.username)),
def __init__(self, parent, client, person): self.title = (_("Change Password for %s") % to_locale(person.person_title)) self.username = person.person_path.split('/')[-1] self.client = client wxDialog.__init__(self, parent, -1, self.title, style=NONMODAL_DLG_STYLE)
from_locale(self.new_pw_ctrl.GetValue()))
from_wx(self.new_pw_ctrl.GetValue()))
def OnOk(self, event=None): if self.new_pw_ctrl.GetValue() != self.confirm_pw_ctrl.GetValue(): wxMessageBox(_("Passwords do not match"), self.title, wxICON_ERROR|wxOK) return try: self.client.changePassword(self.username, from_locale(self.new_pw_ctrl.GetValue())) except SchoolToolError, e: wxMessageBox(_("Could not cha...
self.title = to_locale(person.person_title)
self.title = to_wx(person.person_title)
def __init__(self, parent, client, person): self.title = to_locale(person.person_title) self.person_path = person.person_path self.client = client self.mainframe = parent self.ok = False