示例#1
0
 def create_controller_and_data(self):
     self.controller = MainController()
     self.img_model = self.controller.img_model
     self.mask_model = self.controller.mask_model
     self.calibration_model = self.controller.calibration_model
     self.calibration_model.integrate_1d = MagicMock(
         return_value=(self.calibration_model.tth,
                       self.calibration_model.int))
     self.spectrum_model = self.controller.spectrum_model
     self.phase_model = self.controller.phase_model
示例#2
0
    sections = [separator, time_string, separator, errmsg, separator, tb_info]
    msg = '\n'.join(sections)
    try:
        f = open(log_file, "w")
        f.write(msg)
        f.write(version_info)
        f.close()
    except IOError:
        pass
    errorbox = ErrorMessageBox()
    errorbox.setText(str(notice) + str(msg) + str(version_info))
    errorbox.exec_()

sys.excepthook = excepthook


if __name__ == "__main__":

    from sys import platform as _platform
    from controller.MainController import MainController, get_version
    dioptas_version = get_version()
    print("Dioptas {}".format(dioptas_version))

    if _platform == "linux" or _platform == "linux2" or _platform == "win32" or _platform == 'cygwin':
        app.setStyle('plastique')

    controller = MainController()
    controller.show_window()
    app.exec_()
    del app
示例#3
0
文件: T-Rax.py 项目: nholtgrewe/T-rax
# -*- coding: utf8 -*-
__author__ = 'Clemens Prescher'

import sys
from datetime import datetime

from PyQt4 import QtGui

from controller.MainController import MainController

__version__ = 0.24

from sys import platform

app = QtGui.QApplication(sys.argv)
if platform != "darwin":
    app.setStyle('plastique')
controller = MainController(__version__)
controller.show_window()
app.exec_()
def controller(queue_wr,queue_rd):
    controller = MainController(queue_wr,queue_rd)
    controller.run()
示例#5
0
from multiprocessing import freeze_support

# launch script, do not try to import this
# (if you import it, it will do nothing - import the classes instead)
if __name__ == '__main__':
    freeze_support()
    from controller.MainController import MainController
    from tkinter import Tk

    window = Tk()

    mc = MainController(window)
    mc.start()
#!/usr/bin/env python3
import sys

from controller.MainController import MainController
import re
if __name__ == '__main__':
    dict_regex = {
        'file_path': r"^file_path=(.*)$",
        'delay_refresh_general':
        r"^delay_refresh_general=([0-9]+(\.[0-9]+)?)$",
        'delay_refresh_statistics': r"^delay_refresh_statistics=([0-9]+)$",
        'delay_refresh_alert': r"^delay_refresh_alert=([0-9]+(\.[0-9]+)?)$",
        'threshold': r"^threshold=([0-9]+)$",
    }
    dict_param = {}
    for arg in sys.argv[1:]:
        print(arg)
        for key, reg in dict_regex.items():
            match = re.match(reg, arg)
            if match:
                dict_param[key] = match.group(1)
                del dict_regex[key]
                break
    application = MainController(dict_param)
示例#7
0
from controller.MainController import MainController

MainController()
示例#8
0
]
FILE_NAME = 'log_test.log'


def create_log_test(threadName, delay):
    # with 1s by refresh
    # with a threshold set to 200 => alert between 10s to 20s
    list_nb_to_send = [20] * 20 + [0] * 60
    # creation of the file
    fichier = open(FILE_NAME, "w")
    fichier.close()
    for nb_to_send in list_nb_to_send:
        request_to_send = list_request[rd.randint(0, len(list_request) - 1)]

        with open(FILE_NAME, 'a') as f:
            for i in range(nb_to_send):
                time = datetime.utcnow().replace(
                    tzinfo=timezone.utc).strftime("%d/%b/%Y:%H:%M:%S %z")
                to_send = request_to_send.format(time)
                f.write(to_send + '\n')

        sleep(delay)


if __name__ == '__main__':
    _thread.start_new_thread(create_log_test, ("Thread-1", 1))
    application = MainController({
        'file_path': 'log_test.log',
        'threshold': 200
    })