mirror of
https://github.com/aclist/dztui.git
synced 2026-11-07 02:20:39 +01:00
feat: server connection panel WIP
This commit is contained in:
1 parent
ef2742443f
commit
ad6bdb2e3c
6 files changed
+91
-27
No files matched your search
@@ -4,29 +4,42 @@ from gi.repository import Gtk # noqa E402
|
||||
|
||||
from dzgui.views.components.web_button import WebButton
|
||||
|
||||
class ConnectPanel(Gtk.Grid):
|
||||
class ConnectPanel(Gtk.Frame):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(vexpand=False, margin=20)
|
||||
super().__init__(margin_top=10, margin_bottom=5)
|
||||
|
||||
self.label = Gtk.Label(label="Connect by IP/ID")
|
||||
self.label = Gtk.Label(label="Add/connect")
|
||||
self.label2 = Gtk.Label(label="Favorite server")
|
||||
# TODO: embold function
|
||||
#self.label2.set_markup("<b>Favorite server</b>")
|
||||
self.label2.set_markup("<b>Favorite server</b>")
|
||||
sep = Gtk.Separator()
|
||||
self.entry1 = Gtk.Entry(placeholder_text="Enter IP or Battlemetrics ID", hexpand=False)
|
||||
self.entry2 = Gtk.Entry()
|
||||
self.fav = Gtk.Label("MY favorite server")
|
||||
self.fav = Gtk.Label(label="MY favorite server very long title")
|
||||
self.favedit = Gtk.Button("Edit")
|
||||
self.edit = WebButton(label="EDIT")
|
||||
self.favbutton = Gtk.Button(label="Connect")
|
||||
|
||||
self.attach(self.label, 0, 0, 3, 1)
|
||||
button = Gtk.Button(label="Connect")
|
||||
self.attach_next_to(self.entry1, self.label, Gtk.PositionType.BOTTOM, 3, 1)
|
||||
self.attach_next_to(button, self.entry1, Gtk.PositionType.RIGHT, 3, 1)
|
||||
# TODO: dedent
|
||||
long = """IP: Format as IP:Query port, e.g.\n192.168.1.1:27016\n
|
||||
Battlemetrics: numeric server ID
|
||||
"""
|
||||
|
||||
self.attach_next_to(sep, self.entry1, Gtk.PositionType.BOTTOM, 3, 1)
|
||||
self.attach_next_to(self.label2, sep, Gtk.PositionType.BOTTOM, 3, 1)
|
||||
self.attach_next_to(self.fav, self.label2, Gtk.PositionType.BOTTOM, 3, 1)
|
||||
self.attach_next_to(self.edit, self.fav, Gtk.PositionType.RIGHT, 3, 1)
|
||||
self.attach_next_to(self.favbutton, self.edit, Gtk.PositionType.RIGHT, 3, 1)
|
||||
# TODO: add tooltips to all buttons
|
||||
self.entry1.set_tooltip_text(long)
|
||||
|
||||
self.con = Gtk.Button(label="Connect")
|
||||
self.addb = Gtk.Button(label="Add")
|
||||
|
||||
self.grid = Gtk.Grid(margin=10, vexpand=False, column_spacing=15, row_spacing=5)
|
||||
self.grid.attach(self.label2, 0, 0, 3, 1)
|
||||
button = Gtk.Button(label="Connect")
|
||||
self.grid.attach_next_to(self.fav, self.label2, Gtk.PositionType.RIGHT, 3, 1)
|
||||
self.grid.attach_next_to(self.favbutton, self.fav, Gtk.PositionType.RIGHT, 3, 1)
|
||||
self.grid.attach_next_to(self.label, self.label2, Gtk.PositionType.BOTTOM, 3, 1)
|
||||
self.grid.attach_next_to(self.entry1, self.label, Gtk.PositionType.RIGHT, 3, 1)
|
||||
self.grid.attach_next_to(self.addb, self.entry1, Gtk.PositionType.RIGHT, 3, 1)
|
||||
self.grid.attach_next_to(self.con, self.addb, Gtk.PositionType.RIGHT, 3, 1)
|
||||
|
||||
self.add(self.grid)
|
||||
Reference in new issue
Block a user