Fix various bugs so local GUI tests pass again after merges

This commit is contained in:
Micah Lee 2018-10-10 18:45:55 -07:00
parent ac10b8899f
commit 235fb84dfc
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 10 additions and 8 deletions

View File

@ -196,7 +196,7 @@ class UploadHistoryItem(HistoryItem):
self.started = datetime.now() self.started = datetime.now()
# Label # Label
self.label = QtWidgets.QLabel(strings._('gui_upload_in_progress', True).format(self.started.strftime("%b %d, %I:%M%p"))) self.label = QtWidgets.QLabel(strings._('gui_upload_in_progress').format(self.started.strftime("%b %d, %I:%M%p")))
# Progress bar # Progress bar
self.progress_bar = QtWidgets.QProgressBar() self.progress_bar = QtWidgets.QProgressBar()
@ -274,16 +274,16 @@ class UploadHistoryItem(HistoryItem):
self.ended = self.started = datetime.now() self.ended = self.started = datetime.now()
if self.started.year == self.ended.year and self.started.month == self.ended.month and self.started.day == self.ended.day: if self.started.year == self.ended.year and self.started.month == self.ended.month and self.started.day == self.ended.day:
if self.started.hour == self.ended.hour and self.started.minute == self.ended.minute: if self.started.hour == self.ended.hour and self.started.minute == self.ended.minute:
text = strings._('gui_upload_finished', True).format( text = strings._('gui_upload_finished').format(
self.started.strftime("%b %d, %I:%M%p") self.started.strftime("%b %d, %I:%M%p")
) )
else: else:
text = strings._('gui_upload_finished_range', True).format( text = strings._('gui_upload_finished_range').format(
self.started.strftime("%b %d, %I:%M%p"), self.started.strftime("%b %d, %I:%M%p"),
self.ended.strftime("%I:%M%p") self.ended.strftime("%I:%M%p")
) )
else: else:
text = strings._('gui_upload_finished_range', True).format( text = strings._('gui_upload_finished_range').format(
self.started.strftime("%b %d, %I:%M%p"), self.started.strftime("%b %d, %I:%M%p"),
self.ended.strftime("%b %d, %I:%M%p") self.ended.strftime("%b %d, %I:%M%p")
) )
@ -380,7 +380,7 @@ class History(QtWidgets.QWidget):
# Header # Header
self.header_label = QtWidgets.QLabel(header_text) self.header_label = QtWidgets.QLabel(header_text)
self.header_label.setStyleSheet(self.common.css['downloads_uploads_label']) self.header_label.setStyleSheet(self.common.css['downloads_uploads_label'])
clear_button = QtWidgets.QPushButton(strings._('gui_clear_history', True)) clear_button = QtWidgets.QPushButton(strings._('gui_clear_history'))
clear_button.setStyleSheet(self.common.css['downloads_uploads_clear']) clear_button.setStyleSheet(self.common.css['downloads_uploads_clear'])
clear_button.setFlat(True) clear_button.setFlat(True)
clear_button.clicked.connect(self.reset) clear_button.clicked.connect(self.reset)
@ -486,7 +486,7 @@ class History(QtWidgets.QWidget):
else: else:
image = self.common.get_resource_path('images/share_in_progress.png') image = self.common.get_resource_path('images/share_in_progress.png')
self.in_progress_label.setText('<img src="{0:s}" /> {1:d}'.format(image, self.in_progress_count)) self.in_progress_label.setText('<img src="{0:s}" /> {1:d}'.format(image, self.in_progress_count))
self.in_progress_label.setToolTip(strings._('history_in_progress_tooltip', True).format(self.in_progress_count)) self.in_progress_label.setToolTip(strings._('history_in_progress_tooltip').format(self.in_progress_count))
class ToggleHistory(QtWidgets.QPushButton): class ToggleHistory(QtWidgets.QPushButton):

View File

@ -63,7 +63,7 @@ class ReceiveMode(Mode):
) )
# Receive mode warning # Receive mode warning
receive_warning = QtWidgets.QLabel(strings._('gui_receive_mode_warning', True)) receive_warning = QtWidgets.QLabel(strings._('gui_receive_mode_warning'))
receive_warning.setMinimumHeight(80) receive_warning.setMinimumHeight(80)
receive_warning.setWordWrap(True) receive_warning.setWordWrap(True)

View File

@ -14,6 +14,8 @@ from onionshare.settings import Settings
from onionshare.onion import Onion from onionshare.onion import Onion
from onionshare.web import Web from onionshare.web import Web
from onionshare_gui import Application, OnionShare, OnionShareGui from onionshare_gui import Application, OnionShare, OnionShareGui
from onionshare_gui.mode.share_mode import ShareMode
from onionshare_gui.mode.receive_mode import ReceiveMode
class CommonTests(object): class CommonTests(object):
@ -236,7 +238,7 @@ class CommonTests(object):
def test_server_status_indicator_says_closed(self, mode, stay_open): def test_server_status_indicator_says_closed(self, mode, stay_open):
'''Test that the Server Status indicator shows we closed''' '''Test that the Server Status indicator shows we closed'''
if type(mode) == ReceiveMode: if type(mode) == ReceiveMode:
self.assertEquals(self.gui.receive_mode.server_status_label.text(), strings._('gui_status_indicator_receive_stopped', True)) self.assertEquals(self.gui.receive_mode.server_status_label.text(), strings._('gui_status_indicator_receive_stopped'))
if type(mode) == ShareMode: if type(mode) == ShareMode:
if stay_open: if stay_open:
self.assertEquals(self.gui.share_mode.server_status_label.text(), strings._('gui_status_indicator_share_stopped')) self.assertEquals(self.gui.share_mode.server_status_label.text(), strings._('gui_status_indicator_share_stopped'))