Exemple #1
0
 def get_value_handler(self, g):
     if g is self.opt_change_justification:
         ans = str(g.itemData(g.currentIndex()) or '')
         return ans
     if g is self.opt_filter_css:
         ans = set()
         for key, item in self.FILTER_CSS.items():
             w = getattr(self, 'filter_css_%s' % key)
             if w.isChecked():
                 ans = ans.union(item)
         ans = ans.union(
             set([
                 x.strip().lower()
                 for x in str(self.filter_css_others.text()).split(',')
             ]))
         return ','.join(ans) if ans else None
     if g is self.opt_font_size_mapping:
         val = str(g.text()).strip()
         val = [
             x.strip() for x in val.split(',' if ',' in val else ' ')
             if x.strip()
         ]
         return ', '.join(val) or None
     if g is self.opt_transform_css_rules:
         return json.dumps(g.rules)
     return Widget.get_value_handler(self, g)
Exemple #2
0
 def get_value_handler(self, g):
     if g is self.opt_change_justification:
         ans = unicode(g.itemData(g.currentIndex()).toString())
         return ans
     if g is self.opt_filter_css:
         ans = set()
         for key, item in self.FILTER_CSS.iteritems():
             w = getattr(self, 'filter_css_%s'%key)
             if w.isChecked():
                 ans = ans.union(item)
         ans = ans.union(set([x.strip().lower() for x in
             unicode(self.filter_css_others.text()).split(',')]))
         return ','.join(ans) if ans else None
     return Widget.get_value_handler(self, g)
Exemple #3
0
 def get_value_handler(self, g):
     if g is self.opt_change_justification:
         ans = unicode(g.itemData(g.currentIndex()) or '')
         return ans
     if g is self.opt_filter_css:
         ans = set()
         for key, item in self.FILTER_CSS.iteritems():
             w = getattr(self, 'filter_css_%s'%key)
             if w.isChecked():
                 ans = ans.union(item)
         ans = ans.union(set([x.strip().lower() for x in
             unicode(self.filter_css_others.text()).split(',')]))
         return ','.join(ans) if ans else None
     if g is self.opt_font_size_mapping:
         val = unicode(g.text()).strip()
         val = [x.strip() for x in val.split(',' if ',' in val else ' ') if x.strip()]
         return ', '.join(val) or None
     if g is self.opt_transform_css_rules:
         return json.dumps(g.rules)
     return Widget.get_value_handler(self, g)
Exemple #4
0
 def get_value_handler(self, g):
     if g is not self.opt_markdown_extensions:
         return Widget.get_value_handler(self, g)
     return ', '.join(
         str(i.data(Qt.ItemDataRole.UserRole) or '')
         for i in itervalues(self.md_map) if i.checkState())
Exemple #5
0
 def get_value_handler(self, g):
     if g in (self.opt_input_profile, self.opt_output_profile):
         idx = g.currentIndex().row()
         return g.model().profiles[idx].short_name
     return Widget.get_value_handler(self, g)
Exemple #6
0
 def get_value_handler(self, g):
     if g in (self.opt_input_profile, self.opt_output_profile):
         idx = g.currentIndex().row()
         return g.model().profiles[idx].short_name
     return Widget.get_value_handler(self, g)
Exemple #7
0
 def get_value_handler(self, g):
     if g is not self.opt_markdown_extensions:
         return Widget.get_value_handler(self, g)
     return ', '.join(unicode(i.data(Qt.UserRole) or '') for i in self.md_map.itervalues() if i.checkState())
Exemple #8
0
 def get_value_handler(self, g):
     if g is not self.opt_markdown_extensions:
         return Widget.get_value_handler(self, g)
     return ', '.join(
         unicode(i.data(Qt.UserRole) or '')
         for i in self.md_map.itervalues() if i.checkState())