ui.old.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. from .gtk import Gtk
  2. class app(Gtk.Window):
  3. def __init__(self, logger):
  4. self.logger = logger
  5. super().__init__(title = "CxNewsletter JSON creator")
  6. self.connect("destroy", Gtk.main_quit)
  7. self.content = Gtk.Grid()
  8. self.content.set_column_spacing(4)
  9. self.content.set_row_spacing(4)
  10. self.content.set_column_homogeneous(False)
  11. self.add(self.content)
  12. self.input = Gtk.FileChooserButton()
  13. self.input.set_width_chars(20)
  14. self.input.set_title("Select XLSX file")
  15. self.content.attach(self.input, 0, 0, 2, 1)
  16. input_label = Gtk.Label()
  17. input_label.set_label("Select XLSX")
  18. self.content.attach(input_label, 0, 1, 2, 1)
  19. self.output = Gtk.FileChooserButton()
  20. self.output.set_width_chars(20)
  21. self.input.set_title("Select output JSON")
  22. self.content.attach(self.output, 2, 0, 2, 1)
  23. output_label = Gtk.Label()
  24. output_label.set_label("Select JSON")
  25. self.content.attach(output_label, 2, 1, 2, 1)
  26. self.convert = Gtk.Button()
  27. self.convert.set_label("Convert")
  28. self.convert.connect("clicked", self.convert_clicked)
  29. self.content.attach(self.convert, 0, 2, 4, 1)
  30. name_column = Gtk.Label()
  31. name_column.set_width_chars(40)
  32. name_column.set_xalign(1)
  33. name_column.set_label("Select column with names and surnames")
  34. self.content.attach(name_column, 6, 0, 1, 1)
  35. self.name_column = Gtk.ComboBoxText()
  36. self.content.attach(self.name_column, 7, 0, 1, 1)
  37. email_column = Gtk.Label()
  38. email_column.set_width_chars(40)
  39. email_column.set_xalign(1)
  40. email_column.set_label("Select column with e-mails")
  41. self.content.attach(email_column, 6, 1, 1, 1)
  42. self.email_column = Gtk.ComboBoxText()
  43. self.email_column.set_popup_fixed_width(200)
  44. self.content.attach(self.email_column, 7, 1, 1, 1)
  45. phone_column = Gtk.Label()
  46. phone_column.set_width_chars(40)
  47. phone_column.set_xalign(1)
  48. phone_column.set_label("Select column with phone numbers")
  49. self.content.attach(phone_column, 6, 2, 1, 1)
  50. self.phone_column = Gtk.ComboBoxText()
  51. self.content.attach(self.phone_column, 7, 2, 1, 1)
  52. self.logger.info("App window created.")
  53. def convert_clicked(self, trigger):
  54. self.logger.info("Convert button clicked.")