Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin.action.SlideShow.SlideshowAction Class Reference
Collaboration diagram for MoinMoin.action.SlideShow.SlideshowAction:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def execute
def setSlideNumber
def createParser
def createFormatter
def languageAttributes
def linkToPage
def linkToSlide
def disabledLink
def formatLink
def formatAttributes
def adaptToLanguage
def forwardIcon
def backIcon
def slideLinksRange
def first_slide
def next_slide
def previous_slide
def last_slide
def __getitem__
def item_language_attribtues
def item_theme_url
def item_title
def item_slide_title
def item_slide_body
def item_navigation_language_attributes
def item_navigation_edit
def item_navigation_quit
def item_navigation_start
def item_navigation_end
def item_navigation_back
def item_navigation_forward
def item_forward_key
def item_back_key
def item_navigation_slides
def item_slide_link_base
def item_date
def item_author
def item_counter

Public Attributes

 request
 page
 template
 pageURL
 slideNumber

Static Public Attributes

string name = 'SlideShow'
int maxSlideLinks = 15
int rightArrowKey = 39
int leftArrowKey = 37
 item_action_name = name
 item_next_slide = next_slide
 item_previous_slide = previous_slide
 item_first_slide = first_slide
 item_last_slide = last_slide

Detailed Description

Definition at line 143 of file SlideShow.py.


Constructor & Destructor Documentation

def MoinMoin.action.SlideShow.SlideshowAction.__init__ (   self,
  request,
  pagename,
  template 
)

Definition at line 148 of file SlideShow.py.

00148 
00149     def __init__(self, request, pagename, template):
00150         self.request = request
00151         self.page = SlidePage(self.request, pagename)
00152         self.template = template
00153 
00154         # Cache values used many times
00155         self.pageURL = self.page.url(request)


Member Function Documentation

Definition at line 274 of file SlideShow.py.

00274 
00275     def __getitem__(self, name):
00276         item = getattr(self, 'item_' + name)
00277         if callable(item):
00278             return item()
00279         else:
00280             return item

Here is the caller graph for this function:

Definition at line 235 of file SlideShow.py.

00235 
00236     def adaptToLanguage(self, direction):
00237         # In RTL, directional items should be switched
00238         if i18n.getDirection(self.request.lang) == 'rtl':
00239             return not direction
00240         return direction

Here is the caller graph for this function:

Definition at line 244 of file SlideShow.py.

00244 
00245     def backIcon(self):
00246         return self.forwardIcon(False)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 189 of file SlideShow.py.

00189 
00190     def createFormatter(self, format):
00191         try:
00192             Formatter = wikiutil.importPlugin(self.request.cfg, 'formatter',
00193                                               format, 'Formatter')
00194         except wikiutil.PluginMissingError:
00195             from MoinMoin.formatter.text_plain import Formatter
00196 
00197         formatter = Formatter(self.request)
00198         self.request.formatter = formatter
00199         formatter.page = self.page
00200         return formatter

Here is the caller graph for this function:

def MoinMoin.action.SlideShow.SlideshowAction.createParser (   self,
  format,
  text 
)

Definition at line 178 of file SlideShow.py.

00178 
00179     def createParser(self, format, text):
00180         if format == "wiki":
00181             format = 'text_moin_wiki'
00182         try:
00183             Parser = wikiutil.importPlugin(self.request.cfg, 'parser', format,
00184                                            'Parser')
00185         except wikiutil.PluginMissingError:
00186             from MoinMoin.parser.text import Parser
00187         parser = Parser(text, self.request)
00188         return parser

Here is the caller graph for this function:

def MoinMoin.action.SlideShow.SlideshowAction.disabledLink (   self,
  text,
  attributes 
)

Definition at line 220 of file SlideShow.py.

00220 
00221     def disabledLink(self, text, **attributes):
00222         return '<span%s>%s</span>' % (self.formatAttributes(attributes), text)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 156 of file SlideShow.py.

00156 
00157     def execute(self):
00158         _ = self.request.getText
00159         try:
00160             self.setSlideNumber()
00161             language = self.page.pi['language']
00162             self.request.setContentLanguage(language)
00163             self.request.write(self.template % self)
00164         except Error, err:
00165             self.request.theme.add_msg(unicode(err), "error")
00166             self.page.send_page()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 260 of file SlideShow.py.

00260 
00261     def first_slide(self):
00262         return 1

Here is the caller graph for this function:

Return formatted attributes string 

Definition at line 230 of file SlideShow.py.

00230 
00231     def formatAttributes(self, attributes):
00232         """ Return formatted attributes string """
00233         formattedPairs = [' %s="%s"' % (k, v) for k, v in attributes.items()]
00234         return ''.join(formattedPairs)

Here is the caller graph for this function:

def MoinMoin.action.SlideShow.SlideshowAction.formatLink (   self,
  url,
  text,
  attributes 
)

Definition at line 223 of file SlideShow.py.

00223 
00224     def formatLink(self, url, text, **attributes):
00225         return '<a href="%(url)s"%(attributes)s>%(text)s</a>' % {
00226             'url': wikiutil.escape(url),
00227             'attributes': self.formatAttributes(attributes),
00228             'text': wikiutil.escape(text),
00229             }

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.action.SlideShow.SlideshowAction.forwardIcon (   self,
  forward = True 
)

Definition at line 241 of file SlideShow.py.

00241 
00242     def forwardIcon(self, forward=True):
00243         return [u'\u2190', u'\u2192'][self.adaptToLanguage(forward)]

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 363 of file SlideShow.py.

00363 
00364     def item_author(self):
00365         return wikiutil.escape(self.request.getPragma('author', defval=''))

Definition at line 339 of file SlideShow.py.

00339 
00340     def item_back_key(self):
00341         return self.item_forward_key(False)

Here is the call graph for this function:

Definition at line 366 of file SlideShow.py.

00366 
00367     def item_counter(self):
00368         return "%d|%d" % (self.slideNumber, self.last_slide())
00369 
00370 # This is quite stupid template, but it cleans most of the code from
# html. With smarter templates, there will be no html in the action code.

Here is the call graph for this function:

Definition at line 360 of file SlideShow.py.

00360 
00361     def item_date(self):
00362         return wikiutil.escape(self.request.getPragma('date', defval=''))

def MoinMoin.action.SlideShow.SlideshowAction.item_forward_key (   self,
  forward = True 
)

Definition at line 336 of file SlideShow.py.

00336 
00337     def item_forward_key(self, forward=True):
00338         return (self.leftArrowKey, self.rightArrowKey)[self.adaptToLanguage(forward)]

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 281 of file SlideShow.py.

00281 
00282     def item_language_attribtues(self):
00283         return self.languageAttributes(self.request.content_lang)

Here is the call graph for this function:

Definition at line 326 of file SlideShow.py.

00326 
00327     def item_navigation_back(self):
00328         _ = self.request.getText
00329         number = self.previous_slide()
00330         return self.linkToSlide(number, text=self.backIcon(), title=_('Show previous slide (left arrow)'))

Here is the call graph for this function:

Definition at line 305 of file SlideShow.py.

00305 
00306     def item_navigation_edit(self):
00307         _ = self.request.getText
00308         text = _('Edit')
00309         if self.request.user.may.write(self.page.page_name):
00310             return self.linkToPage(text, 'action=edit', title=_('Edit slide show'))
00311         return self.disabledLink(text, title=_("You are not allowed to edit this page."))

Here is the call graph for this function:

Definition at line 321 of file SlideShow.py.

00321 
00322     def item_navigation_end(self):
00323         _ = self.request.getText
00324         number = self.last_slide()
00325         return self.linkToSlide(number, '|', title=_('Show last slide (down arrow)'))

Here is the call graph for this function:

Definition at line 331 of file SlideShow.py.

00331 
00332     def item_navigation_forward(self):
00333         _ = self.request.getText
00334         number = self.next_slide()
00335         return self.linkToSlide(number, self.forwardIcon(), title=_('Show next slide (right arrow)'))

Here is the call graph for this function:

Definition at line 302 of file SlideShow.py.

00302 
00303     def item_navigation_language_attributes(self):
00304         return self.languageAttributes(self.request.lang)

Here is the call graph for this function:

Definition at line 312 of file SlideShow.py.

00312 
00313     def item_navigation_quit(self):
00314         _ = self.request.getText
00315         return self.linkToPage(_('Quit'), title=_('Quit slide show'))

Here is the call graph for this function:

Definition at line 342 of file SlideShow.py.

00342 
00343     def item_navigation_slides(self):
00344         items = []
00345         for i in self.slideLinksRange():
00346             attributes = {'title': self.page.titleAt(i)}
00347             if i == self.slideNumber:
00348                 attributes = {'class': 'current'}
00349             items.append(self.linkToSlide(i, i, **attributes))
00350         items = ['<li>%s</li>' % item for item in items]
00351         return '\n'.join(items)

Here is the call graph for this function:

Definition at line 316 of file SlideShow.py.

00316 
00317     def item_navigation_start(self):
00318         _ = self.request.getText
00319         number = self.first_slide()
00320         return self.linkToSlide(number, '|', title=_('Show first slide (up arrow)'))

Here is the call graph for this function:

Definition at line 295 of file SlideShow.py.

00295 
00296     def item_slide_body(self):
00297         text = self.page.bodyAt(self.slideNumber)
00298         format = self.page.pi['format']
00299         parser = self.createParser(format, text)
00300         formatter = self.createFormatter('text_html')
00301         return self.request.redirectedOutput(parser.format, formatter)

Here is the call graph for this function:

Definition at line 352 of file SlideShow.py.

00352 
00353     def item_slide_link_base(self):
00354         return wikiutil.escape(self.pageURL) + '?action=%s&n=' % self.name

Definition at line 292 of file SlideShow.py.

00292 
00293     def item_slide_title(self):
00294         return wikiutil.escape(self.page.titleAt(self.slideNumber))

Definition at line 284 of file SlideShow.py.

00284 
00285     def item_theme_url(self):
00286         return '%s/%s' % (self.request.cfg.url_prefix_static, self.request.theme.name)

Definition at line 289 of file SlideShow.py.

00289 
00290     def item_title(self):
00291         return wikiutil.escape(self.page.page_name)

Definition at line 201 of file SlideShow.py.

00201 
00202     def languageAttributes(self, lang):
00203         return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang))

Here is the caller graph for this function:

Definition at line 269 of file SlideShow.py.

00269 
00270     def last_slide(self):
00271         return max(len(self.page), 1)

Here is the caller graph for this function:

def MoinMoin.action.SlideShow.SlideshowAction.linkToPage (   self,
  text,
  query = '',
  attributes 
)
Return a link to current page 

Definition at line 204 of file SlideShow.py.

00204 
00205     def linkToPage(self, text, query='', **attributes):
00206         """ Return a link to current page """
00207         if query:
00208             url = '%s?%s' % (self.pageURL, query)
00209         else:
00210             url = self.pageURL
00211         return self.formatLink(url, text, **attributes)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.action.SlideShow.SlideshowAction.linkToSlide (   self,
  number,
  text,
  attributes 
)
Return a link to current page 

Definition at line 212 of file SlideShow.py.

00212 
00213     def linkToSlide(self, number, text, **attributes):
00214         """ Return a link to current page """
00215         if number == self.slideNumber:
00216             return self.disabledLink(text, **attributes)
00217 
00218         url = '%s?action=%s&n=%s' % (self.pageURL, self.name, number)
00219         return self.formatLink(url, text, **attributes)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 263 of file SlideShow.py.

00263 
00264     def next_slide(self):
00265         return min(self.slideNumber + 1, self.last_slide())

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 266 of file SlideShow.py.

00266 
00267     def previous_slide(self):
00268         return max(self.slideNumber - 1, self.first_slide())

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 169 of file SlideShow.py.

00169 
00170     def setSlideNumber(self):
00171         try:
00172             slideNumber = int(self.request.values.get('n', 1))
00173             if not 1 <= slideNumber <= len(self.page):
00174                 slideNumber = 1
00175         except ValueError:
00176             slideNumber = 1
00177         self.slideNumber = slideNumber

Here is the caller graph for this function:

Return range of slides to display, current centered 

Definition at line 251 of file SlideShow.py.

00251 
00252     def slideLinksRange(self):
00253         """ Return range of slides to display, current centered """
00254         other = self.maxSlideLinks - 1 # other slides except current
00255         first, last = self.first_slide(), self.last_slide()
00256         start = max(first, self.slideNumber - other / 2)
00257         end = min(start + other, last)
00258         start = max(first, end - other)
00259         return range(start, end + 1)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 287 of file SlideShow.py.

Definition at line 357 of file SlideShow.py.

Definition at line 358 of file SlideShow.py.

Definition at line 355 of file SlideShow.py.

Definition at line 356 of file SlideShow.py.

Definition at line 249 of file SlideShow.py.

Definition at line 146 of file SlideShow.py.

string MoinMoin.action.SlideShow.SlideshowAction.name = 'SlideShow' [static]

Definition at line 145 of file SlideShow.py.

Definition at line 150 of file SlideShow.py.

Definition at line 154 of file SlideShow.py.

Definition at line 149 of file SlideShow.py.

Definition at line 248 of file SlideShow.py.

Definition at line 176 of file SlideShow.py.

Definition at line 151 of file SlideShow.py.


The documentation for this class was generated from the following file: