Esempio n. 1
0
 def _get_text(self, item):
     title = item['description']
     if 'name' in item and 'default' in item:
         current_value = get_from_dict(self.wf.settings, item['name'], item['default'])
         if 'list' in item:
             current_value = next((i for i in item['list'] if i[1] == current_value))[0]
         subtitle = u"Current: %s" % (current_value)
     else:
         subtitle = ""
     return title, subtitle
Esempio n. 2
0
 def _show_sub_list(self, sub_list, item, value):
     current_value = get_from_dict(self.wf.settings, item['name'], item['default'])
     for sub_item, sub_value in sub_list:
         if value.lower() in sub_item.lower():
             title = sub_item
             if sub_value == current_value:
                 title += " (selected)"
             self.wf.add_item(title,
                              valid=True,
                              arg=item['name'] + Config.separator + str(sub_value),
                              autocomplete=item['keyword'] + ' ' + sub_item.lower())
Esempio n. 3
0
 def test_get_with_set(self):
     result = get_from_dict(self.test_dict, 'y', 'c')
     self.assertEqual(result, 'c')
     self.assertEqual({'x': 'b', 'y': 'c'}, self.test_dict)
Esempio n. 4
0
 def test_get_success(self):
     result = get_from_dict(self.test_dict, 'x', 'c')
     self.assertEqual(result, 'b')
Esempio n. 5
0
 def test_get_with_set(self):
     result = get_from_dict(self.test_dict, 'y', 'c')
     self.assertEqual(result, 'c')
     self.assertEqual({'x': 'b', 'y': 'c'}, self.test_dict)
Esempio n. 6
0
 def test_get_success(self):
     result = get_from_dict(self.test_dict, 'x', 'c')
     self.assertEqual(result, 'b')
Esempio n. 7
0
 def init_settings(self):
     self.minus = get_from_dict(self.wf.settings, 'minus', DEFAULT_SETTINGS['minus'])
     self.plus = get_from_dict(self.wf.settings, 'plus', DEFAULT_SETTINGS['plus'])
     self.first_day = get_from_dict(self.wf.settings, 'first_day', DEFAULT_SETTINGS['first_day'])
     get_from_dict(self.wf.settings, 'weekdays', DEFAULT_SETTINGS['weekdays'])
     get_from_dict(self.wf.settings, "month", DEFAULT_SETTINGS['month'])
     get_from_dict(self.wf.settings, "width", DEFAULT_SETTINGS['width'])
     get_from_dict(self.wf.settings, "highlight_today", DEFAULT_SETTINGS['highlight_today'])