""" open/DurusWorks/qp/fill/css.qpy """ def format_selectors:str(start, middles=None, end=None): '\n' if not middles: middles = [''] for j, middle in enumerate(middles): start if middle: ' ' middle if end: ' ' end if j < len(middles) - 1: ',\n' else: ' ' def format_style_body:str(*rows): '{\n' for row in rows: if row: ' %s;\n' % row '}\n' def format_style_rule:str(base, selectors, *rows): format_selectors(base, selectors) format_style_body(*rows) class TextStyle (object): def __init__(self, background='', color='', font_style='', other_style='', anchor_style='', hover_style='', visited_style='', link_style=''): self.background = background self.color=color self.font_style=font_style self.other_style = other_style self.anchor_style = anchor_style self.hover_style = hover_style self.visited_style = visited_style self.link_style = link_style def format_rules:str(self, base, selectors, *rows): if self.background: format_style_rule(base, selectors, 'background: %s' % self.background) if self.color: format_style_rule(base, selectors, 'color: %s' % self.color) format_style_rule(base, selectors, self.font_style, self.other_style, *rows) if self.anchor_style: format_selectors(base, selectors, 'a') format_style_body(self.anchor_style) if self.hover_style: format_selectors(base, selectors, 'a:hover') format_style_body(self.hover_style) if self.visited_style: format_selectors(base, selectors, 'a:visited') format_style_body(self.visited_style) if self.link_style: format_selectors(base, selectors, 'a:link') format_style_body(self.link_style) BASIC_FORM_CSS = """\ div.qpform { float: left; } div.qpform div.widget, div.qpform div.submit { clear: left; padding: 0.5ex; margin: 0.5ex; } div.qpform div.widget div.widget, div.qpform div.submit div.widget { margin: 0; padding: 0; clear: none; } div.qpform div.title { font-weight: bold; } div.qpform div.close { clear: left; } div.qpform div.submit div.widget { clear: none; float: left; margin-right: 0.5ex; } div.qpform div.error { color: #c30; font-size: small; margin-top: 0.2ex; } div.qpform div.hint { font-size: small; font-style: italic; margin-top: 1ex; width: 40ex; } div.qpform div.hint a { color: darkblue; } div.qpform div.errornotice { color: #c30; padding: 1ex; margin: 1ex; width: 40ex; } div.qpform div.subwidgets_float_left div.widget { float: left; } div.qpform div.monospace_textarea textarea { font-family: monospace; } body.IE5 div.qpform div.widget, body.IE5 div.qpform div.hint, body.IE5 div.qpform div.submit, body.IE6 div.qpform div.widget, body.IE6 div.qpform div.hint, body.IE6 div.qpform div.submit, body.IE7 div.qpform div.widget, body.IE7 div.qpform div.hint, body.IE7 div.qpform div.submit { height: 1%; /* Set hasLayout property. */ } """