예제 #1
0
  def leftcol_btn_press_table(button):
    tablename = button.get_label()
    truncate_text = "Truncate '" + tablename + "'"
    drop_text = "Drop '" + tablename + "'"
    table_truncate_btn = urwid.AttrWrap( urwid.Button(truncate_text, btn_press_table_truncate, button), 'btnf', 'btn')
    table_drop_btn = urwid.AttrWrap( urwid.Button(drop_text, btn_press_table_drop, button), 'btnf', 'btn')
    secondary_top.original_widget = urwid.AttrWrap(urwid.Padding( urwid.Columns([
      ('fixed', (len(truncate_text) + 4), table_truncate_btn),
      ('fixed', 3, urwid.Text(u"  ")),
      ('fixed', (len(drop_text) + 4), table_drop_btn)
    ]), left=2, right=2), 'topmenu')

    db_table_structure_btn = urwid.AttrWrap( urwid.Button(u"Structure", leftcol_btn_press_table_structure, button.get_label()), 'btnf', 'btn')
    db_table_browse_btn = urwid.AttrWrap( urwid.Button(u"Browse", leftcol_btn_press_table_browse, button.get_label()), 'btnf', 'btn')
    db_table_edit_btn = urwid.AttrWrap( urwid.Button(u"Edit", leftcol_btn_press_table_edit, button.get_label()), 'btnf', 'btn')
    main_top.original_widget = urwid.Columns([
      ('fixed', 13, db_table_structure_btn),
      ('fixed', 3, urwid.Text(u"   ")),
      ('fixed', 8, db_table_edit_btn),
      ('fixed', 3, urwid.Text(u"  ")),
      ('fixed', 10, db_table_browse_btn),
    ])

    main_padding.original_widget = urwid.Pile([
      #tool bar menu
      urwid.AttrWrap( urwid.Divider("-"), 'topmenu'),
      urwid.AttrWrap( main_top, 'topmenu'),
      urwid.AttrWrap( urwid.Divider("-"), 'topmenu'),
      urwid.AttrWrap( secondary_top, 'topmenu'),
      urwid.AttrWrap( urwid.Divider("-"), 'topmenu'),
      #main body
      main_body
    ])

    main_body.original_widget = TableStructure.show_table_structure(user_info, tablename)
    selected.set_text([u" Selected Table: ", button.get_label()])
예제 #2
0
 def leftcol_btn_press_table_structure(button, tablename):
   main_body.original_widget = TableStructure.show_table_structure(user_info, tablename)