def __init__(self, frame, message="", default_text='', modal=True, option=False, optionmessage="", optionvalue=False, droplist=[]): gtk.Dialog.__init__(self) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) self.gotoption = option if modal: self.set_modal(True) box = gtk.VBox(spacing=10) box.set_border_width(10) self.vbox.pack_start(box) box.show() if message: label = gtk.Label(message) box.pack_start(label, False, False) label.set_line_wrap(True) label.show() self.combo = gtk.combo_box_entry_new_text() for i in droplist: self.combo.append_text(i) self.combo.child.set_text(default_text) box.pack_start(self.combo, False, False) self.combo.show() self.combo.grab_focus() self.option = gtk.CheckButton() self.option.set_active(optionvalue) self.option.set_label(optionmessage) self.option.show() if self.gotoption: box.pack_start(self.option, False, False) button = gtk.Button(_("OK")) button.connect("clicked", self.click) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() button.grab_default() button = gtk.Button(_("Cancel")) button.connect("clicked", self.quit) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() self.ret = None
def __init__(self, frame, message="", default_text='', modal= True, option=False, optionmessage="", optionvalue=False, droplist=[]): gtk.Dialog.__init__(self) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) self.gotoption = option if modal: self.set_modal(True) box = gtk.VBox(spacing=10) box.set_border_width(10) self.vbox.pack_start(box) box.show() if message: label = gtk.Label(message) box.pack_start(label, False, False) label.set_line_wrap(True) label.show() self.combo = gtk.combo_box_entry_new_text() for i in droplist: self.combo.append_text( i) self.combo.child.set_text(default_text) box.pack_start(self.combo, False, False) self.combo.show() self.combo.grab_focus() self.option = gtk.CheckButton() self.option.set_active(optionvalue) self.option.set_label(optionmessage) self.option.show() if self.gotoption: box.pack_start(self.option, False, False) button = gtk.Button(_("OK")) button.connect("clicked", self.click) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() button.grab_default() button = gtk.Button(_("Cancel")) button.connect("clicked", self.quit) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.show() self.ret = None
def __init__(self, frame, message="", modal=True, helpdict={}, sort=False): gtk.Dialog.__init__(self) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) if modal: self.set_modal(True) box = gtk.VBox(spacing=5) box.set_border_width(5) self.vbox.pack_start(box) box.show() if message: label = gtk.Label() label.set_alignment(0, 0) label.set_markup(message) box.pack_start(label, False, False) label.set_line_wrap(True) label.show() helplist = helpdict if sort: helplist.sort() self.table1 = gtk.Table(homogeneous=False) self.table1.show() self.table1.set_col_spacings(5) self.table1.set_row_spacings(5) count = 0 for key in helplist: keylabel = gtk.Label() keylabel.set_alignment(0, 0) keylabel.set_markup(key[1]) keylabel.show() self.table1.attach(keylabel, 0, 1, count, count + 1, gtk.FILL, gtk.SHRINK, 0, 0) valuelabel = gtk.Label() valuelabel.set_alignment(0, 0) valuelabel.set_markup(key[2]) valuelabel.set_line_wrap(True) valuelabel.show() self.table1.attach(valuelabel, 1, 2, count, count + 1, gtk.FILL, gtk.SHRINK, 0, 0) count += 1 box.pack_start(self.table1, False, False) button = frame.CreateIconButton(gtk.STOCK_OK, "stock", self.quit, _("OK")) self.action_area.pack_start(button) self.ret = None
def __init__(self, frame, message="", modal= True, helpdict={}, sort=False): gtk.Dialog.__init__(self) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) if modal: self.set_modal(True) box = gtk.VBox(spacing=5) box.set_border_width(5) self.vbox.pack_start(box) box.show() if message: label = gtk.Label() label.set_alignment(0, 0) label.set_markup(message) box.pack_start(label, False, False) label.set_line_wrap(True) label.show() helplist = helpdict if sort: helplist.sort() self.table1 = gtk.Table( homogeneous=False) self.table1.show() self.table1.set_col_spacings(5) self.table1.set_row_spacings(5) count = 0 for key in helplist: keylabel = gtk.Label() keylabel.set_alignment(0, 0) keylabel.set_markup(key[1]) keylabel.show() self.table1.attach(keylabel, 0, 1, count, count+1, gtk.FILL, gtk.SHRINK, 0, 0) valuelabel = gtk.Label() valuelabel.set_alignment(0, 0) valuelabel.set_markup(key[2]) valuelabel.set_line_wrap(True) valuelabel.show() self.table1.attach(valuelabel, 1, 2, count, count+1, gtk.FILL, gtk.SHRINK, 0, 0) count += 1 box.pack_start(self.table1, False, False) button = frame.CreateIconButton(gtk.STOCK_OK, "stock", self.quit, _("OK")) self.action_area.pack_start(button) self.ret = None
def __init__(self, frame, message="", data=None, modal= True): gtk.Dialog.__init__(self) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) self.nicotine = frame if modal: self.set_modal(True) self.box = gtk.VBox(spacing=10) self.box.set_border_width(10) self.box.show() self.vbox.pack_start(self.box) if message: label = gtk.Label() label.set_markup(message) label.set_line_wrap(False) self.box.pack_start(label, False, False) label.show() label.set_alignment(0, 0.5) self.current = 0 self.data = data hbox2 = gtk.HBox(spacing=5) hbox2.show() self.UF = gtk.Frame() self.UF.show() self.UF.set_shadow_type(gtk.SHADOW_ETCHED_IN) self.box.pack_start(self.UF, False, False) vbox3 = gtk.VBox(spacing=5) vbox3.set_border_width(5) vbox3.show() self.UF.add(vbox3) self.Username = self.MakeLabelStaticEntry( hbox2, "<b>Username:</b>", "", expand=False) self.BrowseUser = self.nicotine.CreateIconButton(gtk.STOCK_HARDDISK, "stock", self.OnBrowseUser, _("Browse")) hbox2.pack_start(self.BrowseUser, False, False) self.Position = self.MakeLabelStaticEntry( hbox2, "<b>List Position:</b>", "", expand=False, width=7, xalign=1) vbox3.pack_start(hbox2, False, False) hbox3 = gtk.HBox(spacing=5) hbox3.show() vbox3.pack_start(hbox3, False, False) self.Filename = self.MakeLabelStaticEntry( hbox3, _("<b>File Name:</b>"), "", fill=True) hbox5 = gtk.HBox(spacing=5) hbox5.show() vbox3.pack_start(hbox5, False, False) self.Directory = self.MakeLabelStaticEntry( hbox5, _("<b>Directory:</b>"), "", fill=True) self.Media = gtk.Frame() self.Media.show() self.Media.set_shadow_type(gtk.SHADOW_ETCHED_IN) hbox6 = gtk.HBox(spacing=5, homogeneous=False) hbox6.set_border_width(5) hbox6.show() self.Size = self.MakeLabelStaticEntry( hbox6, _("<b>File Size:</b>"), "", expand=False, width=11, xalign=1) self.Length = self.MakeLabelStaticEntry( hbox6, _("<b>Length:</b>"), "", expand=False, width=7, xalign=0.5) self.Bitrate = self.MakeLabelStaticEntry( hbox6, _("<b>Bitrate:</b>"), "", expand=False, width=12, xalign=0.5) self.Media.add(hbox6) self.box.pack_start(self.Media, False, False) hbox7 = gtk.HBox(spacing=5, homogeneous=False) hbox7.show() self.box.pack_start(hbox7, False, False) self.Immediate = self.MakeLabelStaticEntry( hbox7, _("<b>Immediate Downloads:</b>"), "", expand=False, width=6, xalign=0.5) self.Queue = self.MakeLabelStaticEntry( hbox7, _("<b>Queue:</b>"), "", expand=False, width=6, xalign=1) hbox4 = gtk.HBox(spacing=5, homogeneous=False) hbox4.show() self.box.pack_start(hbox4, False, False) self.Speed = self.MakeLabelStaticEntry( hbox4, _("<b>Last Speed:</b>"), "", expand=False, width=11, xalign=1) self.Country = gtk.Label() self.Country.hide() hbox4.pack_start(self.Country, False, False) self.buttonbox = gtk.HBox(False, 2) self.buttonbox.show() self.buttonbox.set_spacing(2) self.box.pack_start(self.buttonbox, False, False) # Download Button self.DownloadItem = self.nicotine.CreateIconButton(gtk.STOCK_GO_DOWN, "stock", self.OnDownloadItem, _("Download")) self.buttonbox.pack_start(self.DownloadItem, False, False) # Download All Button self.DownloadAll = self.nicotine.CreateIconButton(gtk.STOCK_GO_DOWN, "stock", self.OnDownloadAll, _("Download All")) self.buttonbox.pack_start(self.DownloadAll, False, False) self.Selected = self.MakeLabel( self.buttonbox, "<b>%s</b> File(s) Selected" % len(self.data.keys()), expand=False, xalign=1) self.Previous = self.nicotine.CreateIconButton(gtk.STOCK_GO_BACK, "stock", self.OnPrevious, _("Previous")) self.Next = self.nicotine.CreateIconButton(gtk.STOCK_GO_FORWARD, "stock", self.OnNext, _("Next")) self.buttonbox.pack_end(self.Next, False, False) self.buttonbox.pack_end(self.Previous, False, False) button = self.nicotine.CreateIconButton(gtk.STOCK_CLOSE, "stock", self.click, _("Close")) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.grab_default() self.ret = None self.Display(self.current)
def __init__(self, frame, message="", data=None, modal=True): gtk.Dialog.__init__(self) self.connect("destroy", self.quit) self.connect("delete_event", self.quit) self.nicotine = frame if modal: self.set_modal(True) self.box = gtk.VBox(spacing=10) self.box.set_border_width(10) self.box.show() self.vbox.pack_start(self.box) if message: label = gtk.Label() label.set_markup(message) label.set_line_wrap(False) self.box.pack_start(label, False, False) label.show() label.set_alignment(0, 0.5) self.current = 0 self.data = data hbox2 = gtk.HBox(spacing=5) hbox2.show() self.UF = gtk.Frame() self.UF.show() self.UF.set_shadow_type(gtk.SHADOW_ETCHED_IN) self.box.pack_start(self.UF, False, False) vbox3 = gtk.VBox(spacing=5) vbox3.set_border_width(5) vbox3.show() self.UF.add(vbox3) self.Username = self.MakeLabelStaticEntry(hbox2, "<b>Username:</b>", "", expand=False) self.BrowseUser = self.nicotine.CreateIconButton( gtk.STOCK_HARDDISK, "stock", self.OnBrowseUser, _("Browse")) hbox2.pack_start(self.BrowseUser, False, False) self.Position = self.MakeLabelStaticEntry(hbox2, "<b>List Position:</b>", "", expand=False, width=7, xalign=1) vbox3.pack_start(hbox2, False, False) hbox3 = gtk.HBox(spacing=5) hbox3.show() vbox3.pack_start(hbox3, False, False) self.Filename = self.MakeLabelStaticEntry(hbox3, _("<b>File Name:</b>"), "", fill=True) hbox5 = gtk.HBox(spacing=5) hbox5.show() vbox3.pack_start(hbox5, False, False) self.Directory = self.MakeLabelStaticEntry(hbox5, _("<b>Directory:</b>"), "", fill=True) self.Media = gtk.Frame() self.Media.show() self.Media.set_shadow_type(gtk.SHADOW_ETCHED_IN) hbox6 = gtk.HBox(spacing=5, homogeneous=False) hbox6.set_border_width(5) hbox6.show() self.Size = self.MakeLabelStaticEntry(hbox6, _("<b>File Size:</b>"), "", expand=False, width=11, xalign=1) self.Length = self.MakeLabelStaticEntry(hbox6, _("<b>Length:</b>"), "", expand=False, width=7, xalign=0.5) self.Bitrate = self.MakeLabelStaticEntry(hbox6, _("<b>Bitrate:</b>"), "", expand=False, width=12, xalign=0.5) self.Media.add(hbox6) self.box.pack_start(self.Media, False, False) hbox7 = gtk.HBox(spacing=5, homogeneous=False) hbox7.show() self.box.pack_start(hbox7, False, False) self.Immediate = self.MakeLabelStaticEntry( hbox7, _("<b>Immediate Downloads:</b>"), "", expand=False, width=6, xalign=0.5) self.Queue = self.MakeLabelStaticEntry(hbox7, _("<b>Queue:</b>"), "", expand=False, width=6, xalign=1) hbox4 = gtk.HBox(spacing=5, homogeneous=False) hbox4.show() self.box.pack_start(hbox4, False, False) self.Speed = self.MakeLabelStaticEntry(hbox4, _("<b>Last Speed:</b>"), "", expand=False, width=11, xalign=1) self.Country = gtk.Label() self.Country.hide() hbox4.pack_start(self.Country, False, False) self.buttonbox = gtk.HBox(False, 2) self.buttonbox.show() self.buttonbox.set_spacing(2) self.box.pack_start(self.buttonbox, False, False) # Download Button self.DownloadItem = self.nicotine.CreateIconButton( gtk.STOCK_GO_DOWN, "stock", self.OnDownloadItem, _("Download")) self.buttonbox.pack_start(self.DownloadItem, False, False) # Download All Button self.DownloadAll = self.nicotine.CreateIconButton( gtk.STOCK_GO_DOWN, "stock", self.OnDownloadAll, _("Download All")) self.buttonbox.pack_start(self.DownloadAll, False, False) self.Selected = self.MakeLabel(self.buttonbox, "<b>%s</b> File(s) Selected" % len(self.data.keys()), expand=False, xalign=1) self.Previous = self.nicotine.CreateIconButton(gtk.STOCK_GO_BACK, "stock", self.OnPrevious, _("Previous")) self.Next = self.nicotine.CreateIconButton(gtk.STOCK_GO_FORWARD, "stock", self.OnNext, _("Next")) self.buttonbox.pack_end(self.Next, False, False) self.buttonbox.pack_end(self.Previous, False, False) button = self.nicotine.CreateIconButton(gtk.STOCK_CLOSE, "stock", self.click, _("Close")) button.set_flags(gtk.CAN_DEFAULT) self.action_area.pack_start(button) button.grab_default() self.ret = None self.Display(self.current)