Completely refactor common to make a Common class, and pass that class down into all parts of the program

This commit is contained in:
Micah Lee 2018-03-08 10:18:31 -08:00
parent 49e352d131
commit 50409167d4
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
17 changed files with 458 additions and 444 deletions

View file

@ -19,18 +19,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets, QtGui
from onionshare import common
class Alert(QtWidgets.QMessageBox):
"""
An alert box dialog.
"""
def __init__(self, message, icon=QtWidgets.QMessageBox.NoIcon, buttons=QtWidgets.QMessageBox.Ok, autostart=True):
def __init__(self, common, message, icon=QtWidgets.QMessageBox.NoIcon, buttons=QtWidgets.QMessageBox.Ok, autostart=True):
super(Alert, self).__init__(None)
common.log('Alert', '__init__')
self.common = common
self.common.log('Alert', '__init__')
self.setWindowTitle("OnionShare")
self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))
self.setWindowIcon(QtGui.QIcon(self.common.get_resource_path('images/logo.png')))
self.setText(message)
self.setIcon(icon)
self.setStandardButtons(buttons)