get repo base url and remote directory contents
This commit is contained in:
parent
5171536e18
commit
b108f05ae7
@ -1,3 +1,4 @@
|
||||
import re
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
@ -9,6 +10,7 @@ class MainWindow(Gtk.Window):
|
||||
def __init__(self, url):
|
||||
super().__init__(title = "Simple SVN Browser v%s" % VERSION)
|
||||
|
||||
self.repo_root = None
|
||||
self.cache_file = CacheFile()
|
||||
if (self.cache_file["width"] is not None and
|
||||
self.cache_file["height"] is not None):
|
||||
@ -16,9 +18,11 @@ class MainWindow(Gtk.Window):
|
||||
self.cache_file["height"])
|
||||
|
||||
top_hbox = Gtk.Box()
|
||||
address_entry = Gtk.Entry(text = url)
|
||||
self.address_entry = Gtk.Entry(text = url)
|
||||
self.address_entry.connect("activate", self.on_go_button_clicked)
|
||||
go_button = Gtk.Button(label = "Go")
|
||||
top_hbox.pack_start(address_entry, True, True, 0)
|
||||
go_button.connect("clicked", self.on_go_button_clicked)
|
||||
top_hbox.pack_start(self.address_entry, True, True, 0)
|
||||
top_hbox.pack_start(go_button, False, True, 0)
|
||||
|
||||
vbox = Gtk.Box(orientation = Gtk.Orientation.VERTICAL)
|
||||
@ -45,6 +49,10 @@ class MainWindow(Gtk.Window):
|
||||
def run(self):
|
||||
Gtk.main()
|
||||
|
||||
def on_go_button_clicked(self, widget):
|
||||
self.__refresh(self.address_entry.get_text())
|
||||
return True
|
||||
|
||||
def __close(self, *more):
|
||||
size = self.get_size()
|
||||
position = self.get_position()
|
||||
@ -55,3 +63,29 @@ class MainWindow(Gtk.Window):
|
||||
self.cache_file.write()
|
||||
Gtk.main_quit()
|
||||
return True
|
||||
|
||||
def __refresh(self, url):
|
||||
self.__refresh_repo_root(url)
|
||||
if self.repo_root is not None:
|
||||
self.__refresh_contents(url)
|
||||
else:
|
||||
# TODO: invalidate bottom pane
|
||||
pass
|
||||
|
||||
def __refresh_repo_root(self, url):
|
||||
if (self.repo_root is not None and
|
||||
(url == self.repo_root or
|
||||
url.startswith(self.repo_root + "/"))):
|
||||
# Up to date
|
||||
pass
|
||||
else:
|
||||
stdout, _ = run_svn(["info", url])
|
||||
m = re.search(r'^Repository Root: (.*)$', stdout, re.MULTILINE)
|
||||
if m is not None:
|
||||
self.repo_root = m.group(1)
|
||||
else:
|
||||
self.repo_root = None
|
||||
|
||||
def __refresh_contents(self, url):
|
||||
stdout, _ = run_svn(["ls", url])
|
||||
# TODO: finish
|
||||
|
Loading…
x
Reference in New Issue
Block a user