beginning Downloads layout

This commit is contained in:
Micah Lee 2014-08-27 16:43:18 -07:00
parent d519e62b93
commit e7af77b3f7
4 changed files with 44 additions and 2 deletions

View File

@ -34,7 +34,8 @@
"gui_choose_folder": "Choose folder",
"gui_start_server": "Start Server",
"gui_stop_server": "Stop Server",
"gui_copy_url": "Copy URL"
"gui_copy_url": "Copy URL",
"gui_downloads": "Downloads:"
}, "no": {
"calculating_sha1": "Kalkulerer SHA1 sjekksum.",
"connecting_ctrlport": "Kobler til Tors kontroll-port for å sette opp en gjemt tjeneste på port {0}.",

View File

@ -0,0 +1,26 @@
from PyQt4 import QtCore, QtGui
import common
from onionshare import strings, helpers
class Downloads(QtGui.QVBoxLayout):
def __init__(self):
super(Downloads, self).__init__()
self.addSpacing(10)
# downloads label
self.downloads_label = QtGui.QLabel(strings._('gui_downloads'))
"""progress_bar = QtGui.QProgressBar()
progress_bar.setFormat("12.3 KiB, 17%")
progress_bar.setTextVisible(True)
progress_bar.setAlignment(QtCore.Qt.AlignHCenter)
progress_bar.setMinimum(0)
progress_bar.setMaximum(100)
progress_bar.setValue(17)"""
# hide downloads by default
self.downloads_label.hide()
# add the widgets
self.addWidget(self.downloads_label)
#self.addWidget(progress_bar)

View File

@ -13,6 +13,7 @@ from onionshare import strings, helpers, web
from file_selection import FileSelection
from server_status import ServerStatus
from downloads import Downloads
class Application(QtGui.QApplication):
def __init__(self):
@ -40,10 +41,14 @@ class OnionShareGui(QtGui.QWidget):
# server status
server_status = ServerStatus()
# downloads
downloads = Downloads()
# main layout
self.layout = QtGui.QVBoxLayout()
self.layout.addLayout(file_selection)
self.layout.addLayout(server_status)
self.layout.addLayout(downloads)
self.setLayout(self.layout)
self.show()

View File

@ -6,6 +6,7 @@ from onionshare import strings, helpers
class ServerStatus(QtGui.QVBoxLayout):
def __init__(self):
super(ServerStatus, self).__init__()
self.addSpacing(10)
# server layout
self.status_image = QtGui.QImage('{0}/server_stopped.png'.format(common.onionshare_gui_dir))
@ -22,12 +23,21 @@ class ServerStatus(QtGui.QVBoxLayout):
server_layout.addWidget(self.stop_server_button)
# url layout
self.url_label = QtGui.QLabel('http://mry2aqolyzxwfxpt.onion/x6justoparr5ayreqj6zyf6w2e')
url_font = QtGui.QFont()
url_font.setPointSize(8)
self.url_label = QtGui.QLabel('http://mry2aqolyzxwfxpt.onion/ x6justoparr5ayreqj6zyf6w2e')
self.url_label.setFont(url_font)
self.url_label.setWordWrap(True)
self.url_label.setAlignment(QtCore.Qt.AlignCenter)
self.url_label.setMargin(3)
self.copy_url_button = QtGui.QPushButton(strings._('gui_copy_url'))
self.copy_url_button.clicked.connect(self.copy_url)
url_layout = QtGui.QHBoxLayout()
url_layout.addWidget(self.url_label)
url_layout.addWidget(self.copy_url_button)
# url fields start hidden, until there's a URL
self.url_label.hide()
self.copy_url_button.hide()
# add the widgets
self.addLayout(server_layout)