Exemple #1
0
class DialogLogin(QDialog, Ui_DialogLogin):
    """
    Class documentation goes here.
    """
    def __init__(self, parent=None):
        """
        Constructors
        
        @param parent reference to the parent widget
        @type QWidget
        """
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.lineEdit_password.setEchoMode(QLineEdit.Password)
        self.main_window = None

    @pyqtSignature("")
    def on_pushButton_login_clicked(self):
        """
        Slot documentation goes here.
        """

        username = unicode(self.lineEdit_user.text())
        password = unicode(self.lineEdit_password.text())

        # 创建SQL客户端。保证全局可用。
        global sql_client
        sql_client = globalvar._init(username, password)
        if sql_client.check_user():
            print "登陆成功"
            from main import MainWindow
            self.main_window = MainWindow()
            self.main_window.show()
        else:
            print "用户名或密码错误!"
Exemple #2
0
    def login(self):
        username = self.user_field.text()
        password = self.pass_field.text()
        login_endpoint = self.api_endpoint + "/Login"
        login_request = requests.post(login_endpoint,
                                      data={
                                          'username': username,
                                          'password': password
                                      })
        login_response = json.loads(login_request.text)

        if login_response:
            login_status = login_response["status"]
            login_message = login_response["message"]

            if login_status == 200:
                self.close()
                self.main_window = MainWindow()
                self.main_window.show()
            elif login_status == 100:
                self.error_label.setText('Incorrect username or password')
                self.error_label.show()
            else:
                self.error_label.show()
        else:
            self.error_label.setText('Please try again.')
            self.error_label.show()
Exemple #3
0
def main():
    app = QtGui.QApplication(sys.argv)

    mainWindow = MainWindow()
    mainWindow.show()

    return app.exec_()
Exemple #4
0
class MainWindowTest(unittest.TestCase):
    def setUp(self):
        self.form = MainWindow()

    def test_scrape_process(self):

        urls = [
            'http://www.pythonic.me', 'http://www.onet.pl', 'http://www.wp.pl',
            'http://www.allegro.pl', 'http://www.wykop.pl'
        ]

        urls_number = len(urls)

        self.form.show()
        QTest.qWaitForWindowShown(self.form)

        self.form.load_urls(urls)
        self.assertIn('urls in queue', self.form.statusBar().currentMessage())
        self.assertEqual(urls_number, len(self.form.scraper_dialog.urls))

        QTest.mouseClick(self.form.open_scraper_button, Qt.LeftButton)
        QTest.qWaitForWindowShown(self.form.scraper_dialog)
        QTest.mouseClick(self.form.scraper_dialog.start_button, Qt.LeftButton)

        while self.form.scraper_dialog.scraper_thread.isRunning():
            QApplication.processEvents()

        self.assertIn(
            'keep-alive',
            self.form.scraper_dialog.result_plain_text_edit.toPlainText())
def main():

    app = QtGui.QApplication(sys.argv)
    ex = MainWindow()
    ex.show()
    sys.exit(app.exec_())

    return
    def __init__(self, parent=None):
        super(StartWindow, self).__init__()
        self.ui = startWnd.Ui_StartForm()
        self.ui.setupUi(self)

        self.mw = MainWindow()
        self.mw.set_start_wnd(self)
        self.ui.pbStart.clicked.connect(self.on_start)
        self.ui.pbExit.clicked.connect(self.on_close_clicked)
Exemple #7
0
 def build(self):
     from main import MainWindow
     from core.plugin_wrapper import PluginWrapper
     plugin_wrapper = PluginWrapper('plugins.processing.hotkey')
     hotkey=Hotkey()
     app = MainWindow()
     window = app.build()
     app.plugins['hotkey']={
     'type':'processing','disabled':False,'instance':hotkey,'wrapper':plugin_wrapper}
     return window
Exemple #8
0
 def build(self):
     '''Testing by take this middleware as a plugin of main program'''
     from main import MainWindow
     from core.plugin_wrapper import PluginWrapper
     plugin_wrapper = PluginWrapper('plugins.processing.widget_handler')
     app = MainWindow()
     window = app.build()
     widget_handler = WidgetHandler()
     app.plugins['widget_handler'] = {
         'type': 'processing',
         'disabled': False,
         'wrapper': plugin_wrapper,
         'instance': widget_handler
     }
     return window
	def __init__(self, parent=None):
		super(StartWindow, self).__init__()
		self.ui = startWnd.Ui_StartForm()
		self.ui.setupUi(self)

		self.mw = MainWindow()
		self.mw.set_start_wnd(self)
		self.ui.pbStart.clicked.connect(self.on_start)
		self.ui.pbExit.clicked.connect(self.on_close_clicked)
Exemple #10
0
    def on_pushButton_login_clicked(self):
        """
        Slot documentation goes here.
        """

        username = unicode(self.lineEdit_user.text())
        password = unicode(self.lineEdit_password.text())

        # 创建SQL客户端。保证全局可用。
        global sql_client
        sql_client = globalvar._init(username, password)
        if sql_client.check_user():
            print "登陆成功"
            from main import MainWindow
            self.main_window = MainWindow()
            self.main_window.show()
        else:
            print "用户名或密码错误!"
Exemple #11
0
    def login(self, args):
        username = self.usernameInput.text()
        password = self.passwordInput.text()
        if username == '' or password == '':
            Tools.showMsgDialog(u'用户名或密码不能为空', self)
            return
        self.loginButton.setVisible(False)
        self.progressBar.setVisible(True)
        httpAPI = HttpAPI()
        apiRes = httpAPI.login(username, password)
        if not apiRes[0]:
            Tools.showMsgDialog(apiRes[1], self)
            self.loginButton.setVisible(True)
            self.progressBar.setVisible(False)
            return
        self.close()

        self.mainWindow = MainWindow(apiRes[1])
        self.mainWindow.showMaximized()
class WelcomWindow(QMainWindow, Ui_WelcomWindow):

    panel = None
    
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget
        @type QWidget
        """
        super(WelcomWindow, self).__init__(parent)
        self.setupUi(self)
    
    @pyqtSlot()
    def on_pushButton_clicked(self):
        self.panel = MainWindow()
        self.panel.show()
        self.close()
        return
Exemple #13
0
class Login(QMainWindow, Ui_Login):
    def __init__(self, parent=None):
        super(Login, self).__init__(parent)
        self.setupUi(self)
        self.pwd_lineEdit.setEchoMode(QtGui.QLineEdit.Password)

        self.login_pushButton.clicked.connect(self.doLogin)
        self.exit_pushButton.clicked.connect(self.doExit)

    def doExit(self):
        print("called doExit")
        self.close()
    
    def doLogin(self):
        print("called doLogin")
        usr=unicode(self.usr_lineEdit.text())
        pwd=unicode(self.pwd_lineEdit.text())
        user=User.get_by(username=usr)
        if user:
            if user.password==pwd:
                self.showMain()
            else:
                loginMsgBox = QMessageBox()
                loginMsgBox.setText(u"密码错误." )
                loginMsgBox.exec_()
        else:
            loginMsgBox = QMessageBox()
            loginMsgBox.setText(u"用户不存在." )
            loginMsgBox.exec_()





    def showMain(self):
        self.main = MainWindow()
        #self.main.showFullScreen()
        self.main.show()
        self.close()
Exemple #14
0
def test_connecting_disconnecting_from_gui(qtbot):

    mainWin = MainWindow()
    mainWin.show()
    qtbot.addWidget(mainWin)
    qtbot.wait(2000)
    if_select = mainWin.interfaceSelection
    qtbot.mouseClick(if_select, Qt.LeftButton)
    qtbot.wait(100)
    # check if we see the simulator running and can potentially connect to it
    assert (if_select.findText("cb_sim", Qt.MatchContains) != -1)

    num_connections = 10

    while num_connections > 0:
        if_select.setCurrentIndex(
            if_select.findText("cb_sim", Qt.MatchContains))
        qtbot.wait(500)
        assert (mainWin.nodeIdLineEdit.text() == "cb_sim")
        if_select.setCurrentIndex(if_select.findText("None", Qt.MatchContains))
        qtbot.wait(1000)
        assert (if_select.findText("cb_sim", Qt.MatchContains) != -1)

        num_connections -= 1
    def __init__(self):
        """ Create the windows and set some variables. """

        self.app = MyApp(False)

        self.frame = MainWindow(None, "Region-Fixer-GUI")
        # NOTE: It's very important that the MainWindow is parent of all others windows
        self.backups = BackupsWindow(self.frame, "Backups")
        self.about = AboutWindow(self.frame, "About")
        self.frame.backups = self.backups
        self.frame.about = self.about
        self.frame.help = HelpWindow(self.frame, "Help")
        #         self.frame.error = ErrorWindow(self.frame, "Error")

        self.app.main_window = self.frame
Exemple #16
0
def main():
    ''':return:'''

    app = QApplication(sys.argv)
    mainWindow = MainWindow()

    mainWnd = FramelessWindow()
    mainWnd.setWindowTitle('欢迎窗口login')
    mainWnd.setWindowIcon(QIcon('Qt.ico'))
    mainWnd.setFixedSize(
        QSize(500, 400)
    )  #因为这里固定了大小,所以窗口的大小没有办法任意调整,想要使resizeWidget函数生效的话要把这里去掉,自己调节布局和窗口大小
    mainWnd.setWidget(loginWnd(mainWindow, mainWnd))  # 把自己的窗口添加进来
    mainWnd.show()

    app.exec()
Exemple #17
0
class StartWindow(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super(StartWindow, self).__init__()
        self.ui = startWnd.Ui_StartForm()
        self.ui.setupUi(self)

        self.mw = MainWindow()
        self.mw.set_start_wnd(self)
        self.ui.pbStart.clicked.connect(self.on_start)
        self.ui.pbExit.clicked.connect(self.on_close_clicked)

    def on_close_clicked(self):
        QtWidgets.QApplication.quit()

    def on_start(self):
        diff = int
        count = int

        try:
            diff = int(self.ui.edDiff.text())
        except:
            QtWidgets.QMessageBox.warning(
                self, 'Error',
                'Неверные символы в поле сложность! Необходимо число!',
                QtWidgets.QMessageBox.Yes)
            self.ui.edDiff.setText("1")
            return

        try:
            count = int(self.ui.edCount.text())
        except:
            QtWidgets.QMessageBox.warning(
                self, 'Error',
                'Неверные символы в поле ходов! Необходимо число!',
                QtWidgets.QMessageBox.Yes)
            self.ui.edCount.setText("1")
            return

        if diff < 1:
            QtWidgets.QMessageBox.warning(
                self, 'Error', 'Сложность должны быть больше единицы',
                QtWidgets.QMessageBox.Yes)
            return

        if count < 1:
            QtWidgets.QMessageBox.warning(
                self, 'Error', 'Количество ходов должно быть больше единицы',
                QtWidgets.QMessageBox.Yes)
            return

        self.mw.checker.set_params(diff, count)
        self.mw.start_test()

        self.hide()
        self.mw.show()
Exemple #18
0
class StartWindow(QtWidgets.QDialog):
	def __init__(self, parent=None):
		super(StartWindow, self).__init__()
		self.ui = startWnd.Ui_StartForm()
		self.ui.setupUi(self)

		self.mw = MainWindow()
		self.mw.set_start_wnd(self)
		self.ui.pbStart.clicked.connect(self.on_start)
		self.ui.pbExit.clicked.connect(self.on_close_clicked)

	def on_close_clicked(self):
		QtWidgets.QApplication.quit()

	def on_start(self):
		diff = int
		count = int

		try:
			diff = int( self.ui.edDiff.text() )
		except:
			QtWidgets.QMessageBox.warning(self, 'Error', 'Неверные символы в поле сложность! Необходимо число!', QtWidgets.QMessageBox.Yes)
			self.ui.edDiff.setText("1")
			return

		try:
			count = int( self.ui.edCount.text() )
		except:
			QtWidgets.QMessageBox.warning(self, 'Error', 'Неверные символы в поле ходов! Необходимо число!', QtWidgets.QMessageBox.Yes)
			self.ui.edCount.setText("1")
			return

		if diff < 1:
			QtWidgets.QMessageBox.warning(self, 'Error', 'Сложность должны быть больше единицы', QtWidgets.QMessageBox.Yes)
			return

		if count < 1:
			QtWidgets.QMessageBox.warning(self, 'Error', 'Количество ходов должно быть больше единицы', QtWidgets.QMessageBox.Yes)
			return

		self.mw.checker.set_params(diff, count)
		self.mw.start_test()

		self.hide()
		self.mw.show()
Exemple #19
0
import sys
from PyQt5.QtWidgets import QApplication
from main import MainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)
    mv = MainWindow()
    sys.exit(app.exec_())
 def handle_rx_message(self, msg):
     if msg.id == RxMessage.RxId.freemem:
         self.gui_communication_signal.emit("Freemem: {}".format(msg.msg))
     MainWindow.handle_rx_message(self, msg)
 def __init__(self, *args, **kwargs):
     MainWindow.__init__(self, *args, **kwargs)
     self.digiag_widget.show()
     self.digidiag_window.show()
     self.queue = queue.Queue()
Exemple #22
0
 def Run():
     main = MainWindow()
     main.show()
     gtk.main()
Exemple #23
0
 def setUp(self):
     self.run = MainWindow(app=appctxt)
Exemple #24
0
def main():
    import sys
    app = QtGui.QApplication(sys.argv)
    ui = MainWindow()
    ui.show()
    sys.exit(app.exec_())
Exemple #25
0
def main(argv):

    path = None
    first_arg = None
    second_arg = None
    config = None
    apath = None
    print("QT VERSION %s" % QT_VERSION_STR )

    try:
        first_arg = argv[1]
        second_arg = argv[2]
    except IndexError:
        pass

    if first_arg is not None:
        if first_arg == "-c":
            config = True 
            if second_arg is not None:
                path = second_arg
        else:
            path = first_arg
        
    try:
        #app = QApplication(argv)
        app = MyApp(argv)

        QCoreApplication.setOrganizationDomain('www.trickplay.com');
        QCoreApplication.setOrganizationName('Trickplay');
        QCoreApplication.setApplicationName('Trickplay Debugger');
        QCoreApplication.setApplicationVersion('0.0.1');
            
        s = QProcessEnvironment.systemEnvironment().toStringList()
        for item in s:
            k , v = str( item ).split( "=" , 1 )
            if k == 'PWD':
                apath = v

        apath = os.path.join(apath, os.path.dirname(str(argv[0])))
        main = MainWindow(app, apath)
        main.config = config

        main.show()
        main.raise_()
        wizard = Wizard()
        app.main = main

        path = wizard.start(path)
        if path:
            settings = QSettings()
            settings.setValue('path', path)

            app.setActiveWindow(main)
            main.start(path, wizard.filesToOpen())
            main.show()

        sys.exit(app.exec_())

    # TODO, better way of doing this for 'clean' exit...
    except KeyboardInterrupt:
		exit("Exited")
Exemple #26
0
#!/usr/bin/python
import sys
from PyQt4 import QtCore, QtGui
from main import MainWindow
app = QtGui.QApplication(sys.argv)
win = MainWindow()
win.show()
app.exec_()
Exemple #27
0
        self.messageLabel.setGeometry(QRect(70, 15, 360, 50))
        self.messageLabel.setWordWrap(True)
        self.messageLabel.setScaledContents(True)
        self.messageLabel.setStyleSheet(
            'QLabel{background-color:rgb(255,0,79);color:white;font:9pt;padding-left:5px;padding-right:5px;}'
        )  # border-radius:5px

        # height = self.messageLabel.fontMetrics().boundingRect(self.messageLabel.text()).height()
        self.messageLabel.hide()

    def initSpinner(self):
        self.spinner = QtWaitingSpinner(self,
                                        centerOnParent=True,
                                        disableParentWhenSpinning=True)
        self.spinner.setNumberOfLines(15)
        # self.spinner.setColor(QColor(81, 4, 71))
        self.spinner.setInnerRadius(20)  # 设置内圆大小
        self.spinner.setLineLength(15)  # 设置线长
        self.spinner.setLineWidth(5)  # 设置线宽
        self.spinner.setTrailFadePercentage(80)


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    loginDialog = LoginDialog()
    if loginDialog.exec_() == QDialog.Accepted:
        mainWindow = MainWindow()
        mainWindow.setWindowTitle('{},欢迎您进入余票查询'.format(loginDialog.userName))
        mainWindow.show()
        sys.exit(app.exec_())
Exemple #28
0
 def openMainWindow(self):
     self.mainUIWindow = MainWindow()
     self.hide()
     print('A new window is opened!')
Exemple #29
0
## to Comarch before any contribution is made. You should have received       ##
## a copy of Contribution Agreement along with TADEK bundled with this file   ##
## in the file CONTRIBUTION_AGREEMENT.pdf or see http://tadek.comarch.com     ##
## or write to [email protected]                                     ##
##                                                                            ##
################################################################################

from tadek.core import log

import view
import config
from main import MainWindow

__all__ = ["run"]


def run():
    '''
    Runs the UI application.
    '''
    # Register view classes
    for cls in config.VIEW_CLASSES:
        try:
            view.register(cls)
        except view.ViewError, err:
            log.critical(err)
    # Run the application main window
    window = MainWindow()
    window.run()

Exemple #30
0
# -*- coding: utf-8 -*-

import sys
import atexit
from PyQt4 import QtGui
from PyQt4.QtSql import QSqlDatabase
from main import MainWindow


@atexit.register
def appExit():
    pass

def createConnection(): 
    db=QSqlDatabase.addDatabase("QSQLITE") 
    db.setDatabaseName("sqlite.db3") 
    return db.open()

createConnection()

app = QtGui.QApplication(sys.argv)
app.addLibraryPath("qt4_plugins")
main_window = MainWindow()
main_window.showMaximized()
main_window.show()
sys.exit(app.exec_())
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
#import test     # module test.py
from main import MainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)
    myMainWindow = MainWindow()
    #myUi = test.Ui_MainWindow()
    #myUi.setupUi(myMainWindow)
    myMainWindow.show()
    sys.exit(app.exec_())
Exemple #32
0
#!/usr/bin/env python
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from main import MainWindow
import os

if __name__ == "__main__":
    # Suppress GTK Warnings
    os.environ['G_ENABLE_DIAGNOSTIC'] = "0"
    app = MainWindow()
    app.window.show_all()
    Gtk.main()
Exemple #33
0
 def showMain(self):
     self.main = MainWindow()
     #self.main.showFullScreen()
     self.main.show()
     self.close()
class _MainTester(unittest.TestCase):
    def setUp(self):
        self.mainGui = MainWindow()

    def initializeData(self, dataNumber):
        test_folder = testData[dataNumber]
        self.rawVectorData, self.omf_header, self.odtData, self.stages = MultiprocessingParse.readFolder(
            test_folder)

    def test_initialGui(self):
        self.assertEqual(self.mainGui.windowTitle(),
                         "ESE - Early Spins Enviroment")
        self.assertTrue(self.mainGui.width() > 200)
        self.assertTrue(self.mainGui.height() > 100)
        self.assertTrue(len(self.mainGui.panes) == 4)
        self.assertTrue(self.mainGui.panes[0].isVisible())
        self.assertFalse(self.mainGui.panes[1].isVisible())
        self.assertFalse(self.mainGui.panes[2].isVisible())
        self.assertFalse(self.mainGui.panes[3].isVisible())

    '''def test_loadDirectory(self):
        self.initializeData()
        print(self.mainGui.children())
        self.mainGui.actionLoad_Directory.trigger()
        self.assertTrue(len(self.mainGui.odt_data) > 0)
    '''

    def test_ViewListeners(self):
        self.mainGui.action2_Windows_Grid.trigger()
        self.assertTrue(self.mainGui.panes[0].isVisible())
        self.assertTrue(self.mainGui.panes[1].isVisible())
        self.assertFalse(self.mainGui.panes[2].isVisible())
        self.assertFalse(self.mainGui.panes[3].isVisible())

        self.mainGui.action4_Windows_Grid.trigger()
        self.assertTrue(self.mainGui.panes[0].isVisible())
        self.assertTrue(self.mainGui.panes[1].isVisible())
        self.assertTrue(self.mainGui.panes[2].isVisible())
        self.assertTrue(self.mainGui.panes[3].isVisible())

        self.mainGui.action2_Windows_Grid.trigger()
        self.assertTrue(self.mainGui.panes[0].isVisible())
        self.assertTrue(self.mainGui.panes[1].isVisible())
        self.assertFalse(self.mainGui.panes[2].isVisible())
        self.assertFalse(self.mainGui.panes[3].isVisible())

        self.mainGui.action1_Window_Grid.trigger()
        self.assertTrue(self.mainGui.panes[0].isVisible())
        self.assertFalse(self.mainGui.panes[1].isVisible())
        self.assertFalse(self.mainGui.panes[2].isVisible())
        self.assertFalse(self.mainGui.panes[3].isVisible())

    def test_PlotSettingsNoData(self):
        self.mainGui.actionPlot.trigger()
        label = self.mainGui.plotSettingsWindow.findChild(
            QtWidgets.QLabel, "textLabel")
        self.assertEqual(
            label.text(),
            "There is no data to show. Load data with File > Load Directory")
        accept = self.mainGui.plotSettingsWindow.buttonBox.children()[1]
        QTest.mouseClick(accept, Qt.LeftButton)

    def test_PlotSettingsDataLoaded(self):
        '''tests scenario when data is selected and plot settings clicked. There should be message that no plot has been selected'''
        self.initializeData(0)
        self.mainGui.rawVectorData = self.rawVectorData
        self.mainGui.omf_header = self.omf_header
        self.mainGui.odt_data = self.odtData
        self.mainGui.stages = self.stages

        self.mainGui.actionPlot.trigger()
        label = self.mainGui.plotSettingsWindow.findChild(
            QtWidgets.QLabel, "textLabel")
        self.assertEqual(
            label.text(),
            "No plot pane selected, Go to MainWindow and select pane type meant to show plot."
        )
        accept = self.mainGui.plotSettingsWindow.buttonBox.children()[1]
        QTest.mouseClick(accept, Qt.LeftButton)

    def test_Widgets(self):
        for i in range(4):
            QTest.mouseClick(self.mainGui.panes[i].button, Qt.LeftButton)
            self.mainGui.new.list.setCurrentRow(1)  #Plot2D
            QTest.mouseClick(self.mainGui.new.addButton, Qt.LeftButton)
            self.assertEqual(type(self.mainGui.panes[i].widget), Canvas)

        #this one is problem because of threading - program is not endig after tests completed because of threads in background
    def test_plotSettingsProperData(self):
        for i, _ in enumerate(testData):
            self.initializeData(i)
            self.mainGui.rawVectorData = self.rawVectorData
            self.mainGui.omf_header = self.omf_header
            self.mainGui.odt_data = self.odtData
            self.mainGui.stages = self.stages

            #add 2D plot Widget
            QTest.mouseClick(self.mainGui.panes[0].button, Qt.LeftButton)
            self.mainGui.new.list.setCurrentRow(1)  #createPlot2D
            QTest.mouseClick(self.mainGui.new.addButton, Qt.LeftButton)

            self.assertEqual(type(self.mainGui.panes[0].widget), Canvas)
            self.assertNotEqual(type(self.mainGui.panes[0].widget),
                                CanvasLayer)

            self.mainGui.actionPlot.trigger()
            #print(self.mainGui.plotSettingsWindow.children()[0].children()[2].children()[1])
            self.mainGui.plotSettingsWindow.comboBox[0].setCurrentIndex(5)
            #self.mainGui.plotSettingsWindow.radioButton[1].setChecked(True)

            print(
                self.mainGui.plotSettingsWindow.buttonBox.children()[1].text())
            QTest.mouseClick(
                self.mainGui.plotSettingsWindow.buttonBox.children()[1],
                Qt.LeftButton)

    def test_AnimationSettings(self):
        '''checking if Gui is disabled when there is no data'''
        self.mainGui.showAnimationSettings()

        for element in self.mainGui.playerWindow.gui.elements:
            self.assertFalse(element.isEnabled())

        #GUI still should be disabled
        self.mainGui._LOADED_FLAG_ = True
        for element in self.mainGui.playerWindow.gui.elements:
            self.assertFalse(element.isEnabled())

        self.initializeData(0)
        self.mainGui.rawVectorData = self.rawVectorData
        self.mainGui.omf_header = self.omf_header
        self.mainGui.odt_data = self.odtData
        self.mainGui.stages = self.stages

        # add 2D plot Widget
        QTest.mouseClick(self.mainGui.panes[0].button, Qt.LeftButton)
        self.mainGui.new.list.setCurrentRow(1)  # createPlot2D
        QTest.mouseClick(self.mainGui.new.addButton, Qt.LeftButton)

        self.mainGui.playerWindow.reloadGui()

        for element in self.mainGui.playerWindow.gui.elements:
            self.assertTrue(element.isEnabled())

    def test_PlayerWindow_sliderSpeed(self):
        self.initializeData(0)
        self.mainGui.rawVectorData = self.rawVectorData
        self.mainGui.omf_header = self.omf_header
        self.mainGui.odt_data = self.odtData
        self.mainGui.stages = self.stages
        self.mainGui._LOADED_FLAG_ = True

        QTest.mouseClick(self.mainGui.panes[0].button, Qt.LeftButton)
        self.mainGui.new.list.setCurrentRow(1)  # createPlot2D
        QTest.mouseClick(self.mainGui.new.addButton, Qt.LeftButton)

        self.mainGui.showAnimationSettings()
        x = self.mainGui.playerWindow.gui.slider_speed
        x.setValue(x.minimum())
        self.assertEqual(self.mainGui.playerWindow.gui.speedLabel.text(),
                         "Animation Speed: 0.1")
        x.setValue(x.maximum())
        self.assertEqual(self.mainGui.playerWindow.gui.speedLabel.text(),
                         "Animation Speed: 10.0")
Exemple #35
0
from PySide2.QtWidgets import QApplication
from main import MainWindow

if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)
    win = MainWindow()
    win.show()
    app.exec_()
Exemple #36
0
#!/usr/bin/python

import sys
from PySide import QtGui
from main import MainWindow

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = MainWindow()
    myapp.show()
    sys.exit(app.exec_())
 def setUp(self):
     self.mainGui = MainWindow()
Exemple #38
0
 def __init__(self):
     self.path = "data/0200nm/"
     self.mainGui = MainWindow()
Exemple #39
0
#!/usr/bin/env python3
#
#   run.py
#   Runs a skeleton program that contains a main window and customized menu bar.
#   Using Python 3.6 and PySide2 v.5.12
#
#   Copyright (C) 2019 Robert Parker
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program. If not, see <https://www.gnu.org/licenses/>.

import sys
from PySide2.QtWidgets import QApplication
from main import MainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = MainWindow()
    ex.show()
    sys.exit(app.exec_())
Exemple #40
0
class MainTester(unittest.TestCase):
    def setUp(self):
        self.run = MainWindow(app=appctxt)

    def test_defaults(self):
        self.assertEqual(self.run.ui.b_video_right.isEnabled(), False)
        self.assertEqual(self.run.ui.b_video_left.isEnabled(), False)
        self.assertEqual(self.run.ui.b_video_up.isEnabled(), False)
        self.assertEqual(self.run.ui.b_video_down.isEnabled(), False)
        self.assertEqual(self.run.ui.b_plot_left.isEnabled(), False)
        self.assertEqual(self.run.ui.b_plot_right.isEnabled(), False)
        self.assertEqual(self.run.ui.actionPlay.isEnabled(), False)
        self.assertEqual(self.run.ui.actionOF.isEnabled(), False)
        self.assertEqual(self.run.ui.actionDepth.isEnabled(), False)
        self.assertEqual(self.run.ui.actionOriginal.isEnabled(), False)
        self.assertEqual(self.run.ui.actionOFDirections.isEnabled(), False)
        self.assertEqual(self.run.ui.actionOFArrows.isEnabled(), False)
        self.assertEqual(self.run.ui.actionSuperPixel.isEnabled(), False)
        self.assertEqual(self.run.ui.actionMask.isEnabled(), False)
        self.assertEqual(self.run.ui.actionBackOF.isEnabled(), False)
        self.assertEqual(self.run.ui.b_rerun.isEnabled(), True)

    def test_fps_change(self):
        self.assertEqual(self.run.image_holder.fps, 30)
        self.assertEqual(self.run.ui.t_fps.text(), "30")
        self.run.ui.t_fps.setText("20")
        self.assertEqual(self.run.image_holder.fps, 20)

        self.run.ui.t_fps.setText("-1")
        self.assertEqual(self.run.image_holder.fps, 1)

        self.run.ui.t_fps.setText("100")
        self.assertEqual(self.run.image_holder.fps, self.run.fps_limit)

        self.run.ui.t_fps.setText("asg")
        self.assertEqual(self.run.image_holder.fps, 30)

    def test_description(self):
        self.assertEqual(self.run.ui.l_description.text(), "")
        self.run.cycle_vid.add("original", "/path")
        self.run.cycle_vid.add("of", "/path")
        self.run.changeDescription()
        self.assertEqual(self.run.ui.l_description.text(), "The original video")
        self.run.cycle_vid.up()
        self.run.changeDescription()
        self.assertEqual(
            self.run.ui.l_description.text(),
            "Optical flow (motion of image objects between two consecutive frames)",
        )

    def test_cycle(self):
        self.run.cycle_vid.add("original", "/path")
        self.run.cycle_vid.add("of", "/path")
        self.run.cycle_vid.add("back_of", "/path")
        self.run.cycle_vid.add("depth", "/path")
        self.run.cycle_vid.add("velocity", "/path")
        self.run.cycle_vid.add("mask", "/path")
        self.run.cycle_vid.add("draw", "/path")
        self.run.cycle_vid.add("super_pixel", "/path")
        self.assertEqual(self.run.cycle_vid.currentType(), "original")
        self.run.cycle_vid.up()
        self.assertEqual(self.run.cycle_vid.currentType(), "of")
        self.run.cycle_vid.up()
        self.assertEqual(self.run.cycle_vid.currentType(), "back_of")
        self.run.cycle_vid.down()
        self.assertEqual(self.run.cycle_vid.currentType(), "of")
        self.run.cycle_vid.up()
        self.run.cycle_vid.up()
        self.assertEqual(self.run.cycle_vid.currentType(), "depth")
        self.run.cycle_vid.up()
        self.assertEqual(self.run.cycle_vid.currentType(), "velocity")
        self.run.cycle_vid.up()
        self.assertEqual(self.run.cycle_vid.currentType(), "mask")
        self.run.cycle_vid.up()
        self.run.cycle_vid.up()
        self.run.cycle_vid.down()
        self.assertEqual(self.run.cycle_vid.currentType(), "draw")
        self.run.cycle_vid.up()
        self.assertEqual(self.run.cycle_vid.currentType(), "super_pixel")
        self.run.cycle_vid.up()
        self.assertEqual(self.run.cycle_vid.currentType(), "original")