def CreateInputs(self): self.fromLabel = gtk.Label("From") self.table.attach(self.fromLabel, 1, 2, 1, 2, xpadding=5) self.fromEntry = gtk.combo_box_new_text() self.fromEntry.append_text('Stevenage') self.fromEntry.append_text('Grantham') self.fromEntry.append_text('Peterborough') self.table.attach(self.fromEntry, 2, 3, 1, 2, xpadding=10, ypadding=10) self.toLabel = gtk.Label("To") self.table.attach(self.toLabel, 3, 4, 1, 2, xpadding=5) self.toEntry = gtk.combo_box_new_text() self.toEntry.append_text('Stevenage') self.toEntry.append_text('Grantham') self.toEntry.append_text('Peterborough') self.table.attach(self.toEntry, 4, 5, 1, 2, xpadding=10, ypadding=10) self.date = ComboBoxCalendar("Journey Date", parent_window=self.window) self.table.attach(self.date, 5, 6, 1, 2) self.timeFrame = gtk.Frame("Times") self.timeCBFrameBox = gtk.HBox() self.timeCBFrameBox.pack_start(self.CreateTimeCB(), True, True, 8) self.timeCBFrameBox.pack_start(gtk.Label("Hour"), True, True, 5) self.hourAdj = gtk.Adjustment(value=07, lower=00, upper=23, step_incr=1, page_incr=5, page_size=0) self.timHour = gtk.SpinButton(self.hourAdj, 1, 0) self.timeCBFrameBox.pack_start(self.timHour, True, True, 8) self.timeCBFrameBox.pack_start(gtk.Label(" Min"), True, True, 5) self.minAdj = gtk.Adjustment(value=30, lower=00, upper=59, step_incr=1, page_incr=5, page_size=0) self.timMin = gtk.SpinButton(self.minAdj, 1, 0) self.timeCBFrameBox.pack_start(self.timMin, True, True, 8) self.timeFrame.add(self.timeCBFrameBox) self.table.attach(self.timeFrame, 1, 5, 2, 3, xpadding=5, ypadding=5) self.priceLabel = gtk.Label("Best Price") self.table.attach(self.priceLabel, 5, 6, 2, 3, xpadding=5) self.priceValue = gtk.Label("0.00") self.table.attach(self.priceValue, 6, 7, 2, 3, xpadding=5) self.getButton = gtk.Button("Get Prices") self.table.attach(self.getButton, 7, 8, 1, 2, True, True, xpadding=5) self.getButton.connect("clicked", buildModel, self)
def __init__(self, calendars=None): title = comun.APPNAME + ' | ' + _('Calendar') Gtk.Dialog.__init__( self, title, None, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT, Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)) self.set_size_request(300, 50) self.set_resizable(False) self.set_icon_from_file(comun.ICON) self.connect('destroy', self.close_application) # vbox0 = Gtk.VBox(spacing=5) vbox0.set_border_width(5) self.get_content_area().add(vbox0) # frame1 = Gtk.Frame() vbox0.add(frame1) # table1 = Gtk.Table(rows=7, columns=3, homogeneous=False) table1.set_border_width(2) table1.set_col_spacings(2) table1.set_row_spacings(2) frame1.add(table1) # label1 = Gtk.Label(_('To calendar') + ':') label1.set_alignment(0, .5) table1.attach(label1, 0, 1, 0, 1, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) # self.liststore = Gtk.ListStore(str, str) if calendars is not None: for calendar in calendars: self.liststore.append(calendar['summary'], calendar['id']) self.entry1 = Gtk.ComboBox.new_with_model(model=self.liststore) renderer_text = Gtk.CellRendererText() self.entry1.pack_start(renderer_text, True) self.entry1.add_attribute(renderer_text, "text", 0) self.entry1.set_active(0) table1.attach(self.entry1, 1, 3, 0, 1, xoptions=Gtk.AttachOptions.EXPAND, yoptions=Gtk.AttachOptions.SHRINK) # label2 = Gtk.Label(_('Title') + ':') label2.set_alignment(0., 0.5) table1.attach(label2, 0, 1, 1, 2, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) self.entry2 = Gtk.Entry() self.entry2.set_width_chars(30) table1.attach(self.entry2, 1, 3, 1, 2, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) # label3 = Gtk.Label(_('All day event') + ':') label3.set_alignment(0., 0.5) table1.attach(label3, 0, 2, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) self.entry3 = Gtk.CheckButton() self.entry3.connect('toggled', self.on_check_button_toggled) table1.attach(self.entry3, 2, 3, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) # label4 = Gtk.Label(_('Start date') + ':') label4.set_alignment(0., 0.5) table1.attach(label4, 0, 1, 3, 4, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) self.entry4 = HourEntry() self.entry4.set_visible(True) table1.attach(self.entry4, 1, 2, 3, 4, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) self.entry5 = ComboBoxCalendar(self) table1.attach(self.entry5, 2, 3, 3, 4, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) # label5 = Gtk.Label(_('End date') + ':') label5.set_alignment(0., 0.5) table1.attach(label5, 0, 1, 4, 5, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) self.entry6 = HourEntry() self.entry6.set_visible(True) table1.attach(self.entry6, 1, 2, 4, 5, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) self.entry7 = ComboBoxCalendar(self) table1.attach(self.entry7, 2, 3, 4, 5, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) # label6 = Gtk.Label(_('Description') + ':') label6.set_alignment(0., 0.5) table1.attach(label6, 0, 1, 5, 6, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) # scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) scrolledwindow.set_size_request(300, 300) table1.attach(scrolledwindow, 0, 3, 6, 7, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) self.entry8 = Gtk.TextView() self.entry8.set_wrap_mode(Gtk.WrapMode.WORD) scrolledwindow.add(self.entry8) # self.show_all()
def __init__(self, task=None, tasks=None): Gtk.Dialog.__init__(self) if task == None: self.set_title(comun.APPNAME + ' | ' + _('Add new task')) else: self.set_title(comun.APPNAME + ' | ' + _('Edit task')) self.set_modal(True) self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) self.set_size_request(250, 160) self.set_resizable(False) self.set_icon_from_file(comun.ICON) self.connect('destroy', self.close_application) # vbox0 = Gtk.VBox(spacing=5) vbox0.set_border_width(5) self.get_content_area().add(vbox0) # table1 = Gtk.Table(n_rows=5, n_columns=2, homogeneous=False) table1.set_border_width(5) table1.set_col_spacings(5) table1.set_row_spacings(5) vbox0.add(table1) # label10 = Gtk.Label.new(_('Task List') + ':') label10.set_alignment(0, .5) table1.attach(label10, 0, 1, 0, 1, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) # self.liststore = Gtk.ListStore(str, str) self.entry0 = Gtk.ComboBox.new_with_model(model=self.liststore) renderer_text = Gtk.CellRendererText() self.entry0.pack_start(renderer_text, True) self.entry0.add_attribute(renderer_text, "text", 0) self.entry0.set_active(0) table1.attach(self.entry0, 1, 2, 0, 1, xoptions=Gtk.AttachOptions.EXPAND, yoptions=Gtk.AttachOptions.SHRINK) # label11 = Gtk.Label.new(_('Title') + ':') label11.set_alignment(0, .5) table1.attach(label11, 0, 1, 1, 2, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) # label12 = Gtk.Label.new(_('Notes') + ':') label12.set_alignment(0, 0) table1.attach(label12, 0, 1, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) # label13 = Gtk.Label.new(_('Completed') + ':') label13.set_alignment(0, .5) table1.attach(label13, 0, 1, 3, 4, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) # label14 = Gtk.Label.new(_('Date due') + ':') label14.set_alignment(0, 0) table1.attach(label14, 0, 1, 4, 5, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.SHRINK) # self.entry1 = Gtk.Entry() self.entry1.set_width_chars(60) table1.attach(self.entry1, 1, 2, 1, 2, xoptions=Gtk.AttachOptions.EXPAND, yoptions=Gtk.AttachOptions.SHRINK) # scrolledwindow2 = Gtk.ScrolledWindow() scrolledwindow2.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow2.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) table1.attach(scrolledwindow2, 1, 2, 2, 3, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL) self.entry2 = Gtk.TextView() self.entry2.set_wrap_mode(Gtk.WrapMode.WORD) scrolledwindow2.set_size_request(350, 150) scrolledwindow2.add(self.entry2) # self.entry3 = Gtk.Switch() table1.attach(self.entry3, 1, 2, 3, 4, xoptions=Gtk.AttachOptions.SHRINK, yoptions=Gtk.AttachOptions.SHRINK) # hbox = Gtk.HBox() table1.attach(hbox, 1, 2, 4, 5, xoptions=Gtk.AttachOptions.SHRINK, yoptions=Gtk.AttachOptions.SHRINK) self.entry4 = Gtk.CheckButton() self.entry4.connect('toggled', self.toggle_clicked) hbox.pack_start(self.entry4, 0, 0, 0) self.entry5 = ComboBoxCalendar(self) self.entry5.set_sensitive(False) hbox.pack_start(self.entry5, 0, 0, 0) #table1.attach(self.entry4,1,2,3,4, xoptions = Gtk.AttachOptions.SHRINK, yoptions = Gtk.AttachOptions.SHRINK) # if tasks is not None: for tasklist in tasks.tasklists.values(): self.liststore.append([tasklist['title'], tasklist['id']]) if task is not None: for i, item in enumerate(self.liststore): if task['tasklist_id'] == item[1]: self.entry0.set_active(i) break self.entry0.set_active(False) if 'title' in task.keys(): self.entry1.set_text(task['title']) if 'notes' in task.keys() and task['notes'] is not None: self.entry2.get_buffer().set_text(task['notes']) if 'status' in task.keys(): self.entry3.set_active(task['status'] == 'completed') if 'due' in task.keys() and task['due'] is not None: self.entry4.set_active(True) self.entry5.set_date(rfc3339.parse_datetime(task['due'])) else: self.entry4.set_active(False) else: self.entry0.set_active(0) self.show_all()
def __init__(self, calendars=None): title = comun.APPNAME + ' | '+_('Calendar') Gtk.Dialog.__init__(self,title,None,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT,Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)) self.set_size_request(300, 50) self.set_resizable(False) self.set_icon_from_file(comun.ICON) self.connect('destroy', self.close_application) # vbox0 = Gtk.VBox(spacing = 5) vbox0.set_border_width(5) self.get_content_area().add(vbox0) # frame1 = Gtk.Frame() vbox0.add(frame1) # table1 = Gtk.Table(rows = 7, columns = 3, homogeneous = False) table1.set_border_width(2) table1.set_col_spacings(2) table1.set_row_spacings(2) frame1.add(table1) # label1 = Gtk.Label(_('To calendar')+':') label1.set_alignment(0,.5) table1.attach(label1,0,1,0,1, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) # self.liststore = Gtk.ListStore(str,str) if calendars is not None: for calendar in calendars: self.liststore.append(calendar['summary'],calendar['id']) self.entry1 = Gtk.ComboBox.new_with_model(model=self.liststore) renderer_text = Gtk.CellRendererText() self.entry1.pack_start(renderer_text, True) self.entry1.add_attribute(renderer_text, "text", 0) self.entry1.set_active(0) table1.attach(self.entry1,1,3,0,1, xoptions = Gtk.AttachOptions.EXPAND, yoptions = Gtk.AttachOptions.SHRINK) # label2 = Gtk.Label(_('Title')+':') label2.set_alignment(0.,0.5) table1.attach(label2,0,1,1,2,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry2 = Gtk.Entry() self.entry2.set_width_chars(30) table1.attach(self.entry2,1,3,1,2,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label3 = Gtk.Label(_('All day event')+':') label3.set_alignment(0.,0.5) table1.attach(label3,0,2,2,3,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry3 = Gtk.CheckButton() self.entry3.connect('toggled',self.on_check_button_toggled) table1.attach(self.entry3,2,3,2,3,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label4 = Gtk.Label(_('Start date')+':') label4.set_alignment(0.,0.5) table1.attach(label4,0,1,3,4,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry4 = HourEntry() self.entry4.set_visible(True) table1.attach(self.entry4,1,2,3,4,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) self.entry5 = ComboBoxCalendar(self) table1.attach(self.entry5,2,3,3,4,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label5 = Gtk.Label(_('End date')+':') label5.set_alignment(0.,0.5) table1.attach(label5,0,1,4,5,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry6 = HourEntry() self.entry6.set_visible(True) table1.attach(self.entry6,1,2,4,5,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) self.entry7 = ComboBoxCalendar(self) table1.attach(self.entry7,2,3,4,5,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label6 = Gtk.Label(_('Description')+':') label6.set_alignment(0.,0.5) table1.attach(label6,0,1,5,6,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) # scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) scrolledwindow.set_size_request(300, 300) table1.attach(scrolledwindow,0,3,6,7,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) self.entry8 = Gtk.TextView() self.entry8.set_wrap_mode(Gtk.WrapMode.WORD) scrolledwindow.add(self.entry8) # self.show_all()
def __init__(self, task = None,tasks = None): Gtk.Dialog.__init__(self) if task == None: self.set_title(comun.APPNAME + ' | '+_('Add new task')) else: self.set_title(comun.APPNAME + ' | '+_('Edit task')) self.set_modal(True) self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT,Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL) self.set_size_request(250, 160) self.set_resizable(False) self.set_icon_from_file(comun.ICON) self.connect('destroy', self.close_application) # vbox0 = Gtk.VBox(spacing = 5) vbox0.set_border_width(5) self.get_content_area().add(vbox0) # table1 = Gtk.Table(n_rows = 5, n_columns = 2, homogeneous = False) table1.set_border_width(5) table1.set_col_spacings(5) table1.set_row_spacings(5) vbox0.add(table1) # label10 = Gtk.Label.new(_('Task List')+':') label10.set_alignment(0,.5) table1.attach(label10,0,1,0,1, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # self.liststore = Gtk.ListStore(str,str) self.entry0 = Gtk.ComboBox.new_with_model(model=self.liststore) renderer_text = Gtk.CellRendererText() self.entry0.pack_start(renderer_text, True) self.entry0.add_attribute(renderer_text, "text", 0) self.entry0.set_active(0) table1.attach(self.entry0,1,2,0,1, xoptions = Gtk.AttachOptions.EXPAND, yoptions = Gtk.AttachOptions.SHRINK) # label11 = Gtk.Label.new(_('Title')+':') label11.set_alignment(0,.5) table1.attach(label11,0,1,1,2, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label12 = Gtk.Label.new(_('Notes')+':') label12.set_alignment(0,0) table1.attach(label12,0,1,2,3, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label13 = Gtk.Label.new(_('Completed')+':') label13.set_alignment(0,.5) table1.attach(label13,0,1,3,4, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) # label14 = Gtk.Label.new(_('Date due')+':') label14.set_alignment(0,0) table1.attach(label14,0,1,4,5, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) # self.entry1 = Gtk.Entry() self.entry1.set_width_chars(60) table1.attach(self.entry1,1,2,1,2, xoptions = Gtk.AttachOptions.EXPAND, yoptions = Gtk.AttachOptions.SHRINK) # scrolledwindow2 = Gtk.ScrolledWindow() scrolledwindow2.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow2.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) table1.attach(scrolledwindow2,1,2,2,3, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) self.entry2 = Gtk.TextView() self.entry2.set_wrap_mode(Gtk.WrapMode.WORD) scrolledwindow2.set_size_request(350,150) scrolledwindow2.add(self.entry2) # self.entry3 = Gtk.Switch() table1.attach(self.entry3,1,2,3,4, xoptions = Gtk.AttachOptions.SHRINK, yoptions = Gtk.AttachOptions.SHRINK) # hbox = Gtk.HBox() table1.attach(hbox,1,2,4,5, xoptions = Gtk.AttachOptions.SHRINK, yoptions = Gtk.AttachOptions.SHRINK) self.entry4 = Gtk.CheckButton() self.entry4.connect('toggled', self.toggle_clicked ) hbox.pack_start(self.entry4,0,0,0) self.entry5 = ComboBoxCalendar(self) self.entry5.set_sensitive(False) hbox.pack_start(self.entry5,0,0,0) #table1.attach(self.entry4,1,2,3,4, xoptions = Gtk.AttachOptions.SHRINK, yoptions = Gtk.AttachOptions.SHRINK) # if tasks is not None: for tasklist in tasks.tasklists.values(): self.liststore.append([tasklist['title'],tasklist['id']]) if task is not None: for i,item in enumerate(self.liststore): if task['tasklist_id'] == item[1]: self.entry0.set_active(i) break self.entry0.set_active(False) if 'title' in task.keys(): self.entry1.set_text(task['title']) if 'notes' in task.keys() and task['notes'] is not None: self.entry2.get_buffer().set_text(task['notes']) if 'status' in task.keys(): self.entry3.set_active(task['status'] == 'completed') if 'due' in task.keys() and task['due'] is not None: self.entry4.set_active(True) self.entry5.set_date(rfc3339.parse_datetime(task['due'])) else: self.entry4.set_active(False) else: self.entry0.set_active(0) self.show_all()
def __init__(self, calendars=None, event=None): title = comun.APPNAME + ' | '+_('Calendar') Gtk.Dialog.__init__(self,title,None,Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT,Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)) self.set_size_request(300, 50) self.set_resizable(False) self.set_icon_from_file(comun.ICON) self.connect('destroy', self.close_application) # vbox0 = Gtk.VBox(spacing = 5) vbox0.set_border_width(5) self.get_content_area().add(vbox0) # frame0 = Gtk.Frame() vbox0.add(frame0) # hbox = Gtk.HBox() frame0.add(hbox) # self.button3 = Gtk.ToggleButton() self.button3.set_size_request(40,40) self.button3.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.BUTTON)) self.button3.connect('toggled',self.on_button_toggled,3) hbox.pack_end(self.button3,expand=False, fill=False, padding=0) # self.button2 = Gtk.ToggleButton() self.button2.set_size_request(40,40) self.button2.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_EDIT, Gtk.IconSize.BUTTON)) self.button2.connect('toggled',self.on_button_toggled,2) hbox.pack_end(self.button2,expand=False, fill=False, padding=0) # self.button1 = Gtk.ToggleButton() self.button1.set_size_request(40,40) self.button1.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_FIND, Gtk.IconSize.BUTTON)) self.button1.connect('toggled',self.on_button_toggled,1) hbox.pack_end(self.button1,expand=False, fill=False, padding=0) # frame1 = Gtk.Frame() vbox0.add(frame1) # table1 = Gtk.Table(rows = 7, columns = 3, homogeneous = False) table1.set_border_width(2) table1.set_col_spacings(2) table1.set_row_spacings(2) frame1.add(table1) # label1 = Gtk.Label(_('To calendar')+':') label1.set_alignment(0,.5) table1.attach(label1,0,1,0,1, xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) # self.liststore = Gtk.ListStore(str,str) if calendars is not None: for calendar in calendars: self.liststore.append([calendar['summary'],calendar['id']]) self.entry1 = Gtk.ComboBox.new_with_model(model=self.liststore) renderer_text = Gtk.CellRendererText() self.entry1.pack_start(renderer_text, True) self.entry1.add_attribute(renderer_text, "text", 0) self.entry1.set_active(0) table1.attach(self.entry1,1,3,0,1, xoptions = Gtk.AttachOptions.EXPAND, yoptions = Gtk.AttachOptions.SHRINK) # label2 = Gtk.Label(_('Title')+':') label2.set_alignment(0.,0.5) table1.attach(label2,0,1,1,2,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry2 = Gtk.Entry() self.entry2.set_width_chars(30) table1.attach(self.entry2,1,3,1,2,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label3 = Gtk.Label(_('All day event')+':') label3.set_alignment(0.,0.5) table1.attach(label3,0,2,2,3,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry3 = Gtk.CheckButton() self.entry3.connect('toggled',self.on_check_button_toggled) table1.attach(self.entry3,2,3,2,3,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label4 = Gtk.Label(_('Start date')+':') label4.set_alignment(0.,0.5) table1.attach(label4,0,1,3,4,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry4 = HourEntry() self.entry4.set_visible(True) table1.attach(self.entry4,1,2,3,4,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) self.entry5 = ComboBoxCalendar(self) table1.attach(self.entry5,2,3,3,4,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label5 = Gtk.Label(_('End date')+':') label5.set_alignment(0.,0.5) table1.attach(label5,0,1,4,5,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) self.entry6 = HourEntry() self.entry6.set_visible(True) table1.attach(self.entry6,1,2,4,5,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) self.entry7 = ComboBoxCalendar(self) table1.attach(self.entry7,2,3,4,5,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) # label6 = Gtk.Label(_('Description')+':') label6.set_alignment(0.,0.5) table1.attach(label6,0,1,5,6,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.SHRINK) # scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) scrolledwindow.set_size_request(300, 300) table1.attach(scrolledwindow,0,3,6,7,xoptions = Gtk.AttachOptions.FILL, yoptions = Gtk.AttachOptions.FILL) self.entry8 = Gtk.TextView() self.entry8.set_wrap_mode(Gtk.WrapMode.WORD) scrolledwindow.add(self.entry8) # self.show_all() if event is not None: self.button1.set_active(True) self.entry1.set_sensitive(False) for i,item in enumerate(self.liststore): if event['calendar_id'] == item[1]: self.entry1.set_active(i) break if 'summary' in event.keys(): self.entry2.set_text(event['summary']) now = datetime.datetime.now() if 'date' in event['start'].keys(): self.entry3.set_active(True) self.entry5.set_date(event.get_start_date().date()) self.entry7.set_date(event.get_end_date().date()) else: self.entry3.set_active(False) self.entry4.set_time(event.get_start_date().time()) self.entry5.set_date(event.get_start_date().date()) self.entry6.set_time(event.get_end_date().time()) self.entry7.set_date(event.get_end_date().date()) if 'description' in event.keys(): self.entry8.get_buffer().set_text(event['description']) else: anow = (datetime.datetime.now()+datetime.timedelta(days=1)).replace(minute=0) anowd = anow + datetime.timedelta(hours=1) self.entry4.set_time(anow.time()) self.entry5.set_date(anow.date()) self.entry6.set_time(anowd.time()) self.entry7.set_date(anowd.date()) self.button2.set_active(True) self.entry1.set_sensitive(True) self.button1.set_sensitive(False) self.button2.set_sensitive(False) self.button3.set_sensitive(False)