break up package a little bit; start on MainWindow

This commit is contained in:
Josh Holtrop 2016-06-22 14:52:16 -04:00
parent 725e241984
commit 2cb8bbece1
5 changed files with 32 additions and 13 deletions

View File

@ -1,9 +1,3 @@
from simplesvnbrowser.main_window import MainWindow from .main_window import MainWindow
import subprocess from .run_svn import run_svn
from .version import VERSION
def run_svn(args):
completed_process = subprocess.run(
["svn", "--non-interactive"] + args,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
return completed_process.stdout.decode(), completed_process.stderr.decode()

View File

@ -11,7 +11,8 @@ def run(argv):
wc_path = argv[1] wc_path = argv[1]
if url is None: if url is None:
url = determine_url_from_wc(wc_path) url = determine_url_from_wc(wc_path)
# TODO: start with url mw = simplesvnbrowser.MainWindow(url)
mw.run()
def determine_url_from_wc(path): def determine_url_from_wc(path):
stdout, _ = simplesvnbrowser.run_svn(["info", path]) stdout, _ = simplesvnbrowser.run_svn(["info", path])

View File

@ -1,3 +1,18 @@
class MainWindow: import gi
def __init__(self): gi.require_version("Gtk", "3.0")
pass from gi.repository import Gtk
from .version import VERSION
from .run_svn import run_svn
class MainWindow(Gtk.Window):
def __init__(self, url):
super().__init__(title = "Simple SVN Browser v%s" % VERSION)
button = Gtk.Button(label = "content")
self.add(button)
self.connect("delete-event", Gtk.main_quit)
self.show_all()
def run(self):
Gtk.main()

View File

@ -0,0 +1,8 @@
import subprocess
def run_svn(args):
completed_process = subprocess.run(
["svn", "--non-interactive"] + args,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
return completed_process.stdout.decode(), completed_process.stderr.decode()

View File

@ -0,0 +1 @@
VERSION = "0.0.1"