~dpm/qreator/snap

« back to all changes in this revision

Viewing changes to qreator/qrcodes/QRCodeVCardGtk.py

  • Committer: Stefan Schwarzburg
  • Date: 2012-11-30 12:30:45 UTC
  • mfrom: (111.1.2 qreator_fix_1082705)
  • Revision ID: stefan.schwarzburg@googlemail.com-20121130123045-3z30pv1evqnw6sql
merged with branch to fix bug 1082705

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
 
80
80
class VCardEntry(object):
81
 
    """The class gets three variables: instances, grid and row
 
81
    """The class gets two variables:
 
82
    instances and row
 
83
 
82
84
    instances acts as a registry of elements in the vcard object
 
85
    and row will keep track of the latest position to add elements
 
86
    to the grid
 
87
    grid is a variable that is populated by the individual
 
88
    VCardEntry objects.
83
89
    """
84
90
    instances = []
85
91
 
86
 
    def __init__(self, entry_id):
 
92
    def __init__(self, entry_id, get_widget, widget_name):
87
93
        self.entry_id = entry_id
88
94
        self.entry_field = ENTRY_TYPES[entry_id][1]
89
95
        self.entry_text = ENTRY_TYPES[entry_id][0]
 
96
        self.grid = get_widget(widget_name)
90
97
        VCardEntry.instances.append(self)
91
98
 
92
99
    def add_sep(self, on_changed):
355
362
        self["entry1"].connect("icon-press", on_icon)
356
363
        self["entry2"].connect("icon-press", on_icon)
357
364
        VCardEntry.row = 3
358
 
        VCardEntry.grid = self['grid1']
359
365
        self.grid = self['qr_code_vcard']
360
366
 
361
367
    def create_vcard(self):
417
423
        entry_type = ENTRY_TYPES[e_id][1]
418
424
        #text = ENTRY_TYPES[e_id][0]
419
425
        if entry_type in ["email", "url"]:
420
 
            GenericWithUsage(e_id).create_widget(self.on_changed)
 
426
            GenericWithUsage(e_id, self.builder.get_object,
 
427
                             "grid1").create_widget(self.on_changed)
421
428
        elif entry_type == "tel":
422
 
            Phone(e_id).create_widget(self.on_changed)
 
429
            Phone(e_id, self.builder.get_object,
 
430
                  "grid1").create_widget(self.on_changed)
423
431
        elif entry_type == "adr":
424
 
            Address(e_id).create_widget(self.on_changed)
 
432
            Address(e_id, self.builder.get_object,
 
433
                    "grid1").create_widget(self.on_changed)
425
434
        elif entry_type in ["title", "org", "role", "nickname", "note"]:
426
 
            VCardEntry(e_id).create_widget(self.on_changed)
427
 
 
 
435
            VCardEntry(e_id, self.builder.get_object,
 
436
                       "grid1").create_widget(self.on_changed)
428
437
        def update_scroll():
429
438
            self["scrolledwindow1"].get_vadjustment().set_value(
430
439
                self["scrolledwindow1"].get_vadjustment().get_upper())