comparison MoinMoin/theme/__init__.py @ 734:bf2435e61f97

moved smileys from MoinMoin.config to theme, fixed smiley text_python caching bug
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 02 Jun 2006 16:58:56 +0200
parents e3b84c7488e8
children 8e880418d736
comparison
equal deleted inserted replaced
733:5b2029e9fc58 734:bf2435e61f97
62 'ftp': ("[FTP]", "moin-ftp.png", 11, 11), 62 'ftp': ("[FTP]", "moin-ftp.png", 11, 11),
63 'file': ("[FILE]", "moin-ftp.png", 11, 11), 63 'file': ("[FILE]", "moin-ftp.png", 11, 11),
64 # search forms 64 # search forms
65 'searchbutton': ("[?]", "moin-search.png", 12, 12), 65 'searchbutton': ("[?]", "moin-search.png", 12, 12),
66 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16), 66 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16),
67
68 # smileys (this is CONTENT, but good looking smileys depend on looking
69 # adapted to the theme background color and theme style in general)
70 #vvv == vvv this must be the same for GUI editor converter
71 'X-(': ("X-(", 'angry.png', 15, 15),
72 ':D': (":D", 'biggrin.png', 15, 15),
73 '<:(': ("<:(", 'frown.png', 15, 15),
74 ':o': (":o", 'redface.png', 15, 15),
75 ':(': (":(", 'sad.png', 15, 15),
76 ':)': (":)", 'smile.png', 15, 15),
77 'B)': ("B)", 'smile2.png', 15, 15),
78 ':))': (":))", 'smile3.png', 15, 15),
79 ';)': (";)", 'smile4.png', 15, 15),
80 '/!\\': ("/!\\", 'alert.png', 15, 15),
81 '<!>': ("<!>", 'attention.png', 15, 15),
82 '(!)': ("(!)", 'idea.png', 15, 15),
83
84 # copied 2001-11-16 from http://pikie.darktech.org/cgi/pikie.py?EmotIcon
85 ':-?': (":-?", 'tongue.png', 15, 15),
86 ':\\': (":\\", 'ohwell.png', 15, 15),
87 '>:>': (">:>", 'devil.png', 15, 15),
88 '|)': ("|)", 'tired.png', 15, 15),
89
90 # some folks use noses in their emoticons
91 ':-(': (":-(", 'sad.png', 15, 15),
92 ':-)': (":-)", 'smile.png', 15, 15),
93 'B-)': ("B-)", 'smile2.png', 15, 15),
94 ':-))': (":-))", 'smile3.png', 15, 15),
95 ';-)': (";-)", 'smile4.png', 15, 15),
96 '|-)': ("|-)", 'tired.png', 15, 15),
97
98 # version 1.0
99 '(./)': ("(./)", 'checkmark.png', 20, 15),
100 '{OK}': ("{OK}", 'thumbs-up.png', 14, 12),
101 '{X}': ("{X}", 'icon-error.png', 16, 16),
102 '{i}': ("{i}", 'icon-info.png', 16, 16),
103 '{1}': ("{1}", 'prio1.png', 15, 13),
104 '{2}': ("{2}", 'prio2.png', 15, 13),
105 '{3}': ("{3}", 'prio3.png', 15, 13),
106
107 # version 1.3.4 (stars)
108 # try {*}{*}{o}
109 '{*}': ("{*}", 'star_on.png', 15, 15),
110 '{o}': ("{o}", 'star_off.png', 15, 15),
67 } 111 }
68 del _ 112 del _
69 113
70 # Style sheets - usually there is no need to override this in sub 114 # Style sheets - usually there is no need to override this in sub
71 # classes. Simply supply the css files in the css directory. 115 # classes. Simply supply the css files in the css directory.
404 @param icon: icon name or file name (string) 448 @param icon: icon name or file name (string)
405 @rtype: tuple 449 @rtype: tuple
406 @return: alt (unicode), href (string), width, height (int) 450 @return: alt (unicode), href (string), width, height (int)
407 """ 451 """
408 if icon in self.icons: 452 if icon in self.icons:
409 alt, filename, w, h = self.icons[icon] 453 alt, icon, w, h = self.icons[icon]
410 else: 454 else:
411 # Create filenames to icon data mapping on first call, then 455 # Create filenames to icon data mapping on first call, then
412 # cache in class for next calls. 456 # cache in class for next calls.
413 if not getattr(self.__class__, 'iconsByFile', None): 457 if not getattr(self.__class__, 'iconsByFile', None):
414 d = {} 458 d = {}
415 for data in self.icons.values(): 459 for data in self.icons.values():
416 d[data[1]] = data 460 d[data[1]] = data
417 self.__class__.iconsByFile = d 461 self.__class__.iconsByFile = d
418 462
419 # Try to get icon data by file name 463 # Try to get icon data by file name
420 filename = icon.replace('.gif','.png') 464 if icon in self.iconsByFile:
421 if filename in self.iconsByFile: 465 alt, icon, w, h = self.iconsByFile[icon]
422 alt, filename, w, h = self.iconsByFile[filename]
423 else: 466 else:
424 alt, filename, w, h = '', icon, '', '' 467 alt, icon, w, h = '', icon, '', ''
425 468
426 return alt, self.img_url(filename), w, h 469 return alt, self.img_url(icon), w, h
427 470
428 def make_icon(self, icon, vars=None): 471 def make_icon(self, icon, vars=None):
429 """ 472 """
430 This is the central routine for making <img> tags for icons! 473 This is the central routine for making <img> tags for icons!
431 All icons stuff except the top left logo, smileys and search 474 All icons stuff except the top left logo and search field icons are
432 field icons are handled here. 475 handled here.
433 476
434 @param icon: icon id (dict key) 477 @param icon: icon id (dict key)
435 @param vars: ... 478 @param vars: ...
436 @rtype: string 479 @rtype: string
437 @return: icon html (img tag) 480 @return: icon html (img tag)