PyQt4 после запуска лишь немного моргает и сразу закрывается. Никаких сообщений об ошибках. Переустанавливал модуль - не помогло.
Код:
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui, uic
import base64
class GeneralWindow(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
Form, Base = uic.loadUiType("form.ui")
self.ui = Form()
self.ui.setupUi(self)
# Buttons
self.connect(self.ui.input_file_button, QtCore.SIGNAL("clicked()"),
self.input_files)
self.connect(self.ui.white_list_button, QtCore.SIGNAL("clicked()"),
self.white_list)
self.connect(self.ui.output_file_button, QtCore.SIGNAL("clicked()"),
self.output_file)
self.connect(self.ui.load_settings_button, QtCore.SIGNAL("clicked()"),
self.load_settings)
#self.connect(self.ui.find_domains_button, QtCore.SIGNAL("clicked()"),
# self.run)
# Password Mode
self.ui.access_id_text.setEchoMode(3)
self.ui.secret_key_text.setEchoMode(3)
self.ui.majestic_name_text.setEchoMode(3)
self.ui.majestic_login_text.setEchoMode(3)
self.ui.majestic_password_text.setEchoMode(3)
def input_files(self):
self.input_file_directory = QtGui.QFileDialog.getExistingDirectory(self, 'Select Folder', '/home')
self.ui.input_file_text.setText(self.input_file_directory)
def white_list(self):
self.white_list_file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '/home')
self.ui.white_list_text.setText(self.white_list_file)
def output_file(self):
self.output_file_directory = QtGui.QFileDialog.getSaveFileName(self, 'Save file', 'domains.csv')
self.ui.output_file_text.setText(self.output_file_directory)
def load_settings(self):
self.load_cfg = QtGui.QFileDialog.getOpenFileName(self, 'Open file')
with open(self.load_cfg, 'r') as f:
cfg = list(map(lambda x: x.strip(), f.readlines()))
configuration = dict(list(map(lambda x: x.split(':::'), filter(lambda x: ":::" in x, cfg))))
self.ui.input_file_text.setText(configuration['PATH_INPUT_FILE'])
self.ui.white_list_text.setText(configuration['WHITE_LIST'])
self.ui.access_id_text.setText(base64.b64decode(configuration['ACCESSID']))
self.ui.secret_key_text.setText(base64.b64decode(configuration['SECRETKEY']))
self.ui.majestic_name_text.setText(base64.b64decode(configuration['MSEO_NAME']))
self.ui.majestic_login_text.setText(base64.b64decode(configuration['MSEO_LOGIN']))
self.ui.majestic_password_text.setText(base64.b64decode(configuration['MSEO_PASS']))
self.ui.output_file_text.setText(configuration['CSVFILE'])
self.ui.output_file_delimiter.setText(configuration['DELIMITER'])
self.ui.output_file_terminator.setText(configuration['LINETERMINATOR'])
self.ui.concurrent_items_spin.setValue(int(configuration['CONCURRENT_ITEMS']))
self.ui.download_delay_spin.setValue(float(configuration['DOWNLOAD_DELAY']))
self.ui.concurrent_request_spin.setValue(int(configuration['CONCURRENT_REQUESTS']))
self.ui.minimal_pa_spin.setValue(int(configuration['MIN_PA']))
def closeEvent(self, e):
result = QtGui.QMessageBox.question(self,
"Close",
"Do you really want to close the window?",
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
QtGui.QMessageBox.No)
if result == QtGui.QMessageBox.Yes:
e.accept()
QtGui.QWidget.closeEvent(self, e)
else:
e.ignore()
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
window = GeneralWindow()
window.show()