def testEqual(self):
     testProjectA = Project(title="TestProjectA",
                            fixedData="FixedTest",
                            movingData="MovingTest",
                            isReference=True)
     testProjectB = Project(title="TestProjectB",
                            fixedData="FixedTest",
                            movingData="MovingTest",
                            isReference=True)
     self.assertEqual(testProjectA, testProjectA)
     self.assertNotEqual(testProjectA, testProjectB)
     testProjectB.title = "TestProjectA"
     self.assertEqual(testProjectA, testProjectB)
Esempio n. 2
0
    def initialize_project(self, project_dict):
        import datetime
        # Create new instance of project
        # 05/31/1988
        project = Project()
        if 'project_name' in project_dict:
            project.project_name = project_dict['project_name']
        project.tasks = project_dict['tasks']

        if 'interval_major_grid' in project_dict:
            project.interval_major_axis = project_dict['interval_major_grid']

        if 'start_date' in project_dict:
            sd = project_dict['start_date']
            project.start_date = sd
        else:
            project.start_date = datetime.datetime.today(
            )  #wx.DateTime().Now()
            print(project.start_date)

        if 'project_name' in project_dict:
            project.project_name = project_dict['project_name']

        if 'project_manager' in project_dict:
            project.project_manager = project_dict['project_manager']

        self.parent.project = project

        self.project = project

        self.parent.left_pane.project = project
        self.parent.right_pane.project = project

        self.parent.left_pane.populate()
        self.parent.right_pane.redraw()
Esempio n. 3
0
 def read(self,file,owner):
     _, tail = os.path.split(file)
     p = Project(None)
     tree = etree.parse(file)
     root = tree.getroot() #tj.root
     for child in root: #tj.project
         p_att = child.attrib
         #p.file = file
         p.name = tail
         p.owner = owner #p_att["owner"]
         p.dtFrom = datetime.strptime(p_att["dt_from"], "%d.%m.%Y")
         p.dtTo = datetime.strptime(p_att["dt_to"], "%d.%m.%Y")
         p.folderId = None            
         for subChild in child: #tj.engine
             e = Engine(None)
             e_att = subChild.attrib
             e.name = e_att["name"]
             for subSubChild in subChild: #tj.job
                 j = Job(None)
                 j_att = subSubChild.attrib
                 j.name = j_att["name"]
                 j.days = int(j_att["days"])
                 j.duration = int(j_att["duration"])
                 j.start = datetime.strptime(j_att["start"], "%d.%m.%Y")
                 j.color = j_att["color"]
                 #j.engine = e.name
                 e.addJob(j)
             p.addEngine(e)
     return p
Esempio n. 4
0
    def __init__(self, app):
        """
        Initialization of the Main window. This is directly called after the
        Logger has been initialized. The Function loads the GUI, creates the
        used Classes and connects the actions to the GUI.
        """
        QMainWindow.__init__(self)

        # Build the configuration window
        self.config_window = ConfigWindow(g.config.makeConfigWidgets(),
                                          g.config.var_dict,
                                          g.config.var_dict.configspec, self)
        self.config_window.finished.connect(self.updateConfiguration)

        self.app = app

        self.ui = Ui_MainWindow()

        self.ui.setupUi(self)
        self.showMaximized()

        self.canvas = self.ui.canvas
        if g.config.mode3d:
            self.canvas_scene = self.canvas
        else:
            self.canvas_scene = None

        self.TreeHandler = TreeHandler(self.ui)
        self.configuration_changed.connect(
            self.TreeHandler.updateConfiguration)

        #Load the post-processor configuration and build the post-processor configuration window
        self.MyPostProcessor = MyPostProcessor()
        # If string version_mismatch isn't empty, we popup an error and exit
        if self.MyPostProcessor.version_mismatch:
            error_message = QMessageBox(QMessageBox.Critical,
                                        'Configuration error',
                                        self.MyPostProcessor.version_mismatch)
            sys.exit(error_message.exec_())

        self.d2g = Project(self)

        self.createActions()
        self.connectToolbarToConfig()

        self.filename = ""

        self.valuesDXF = None
        self.shapes = Shapes([])
        self.entityRoot = None
        self.layerContents = Layers([])
        self.newNumber = 1

        self.cont_dx = 0.0
        self.cont_dy = 0.0
        self.cont_rotate = 0.0
        self.cont_scale = 1.0
Esempio n. 5
0
    def xmit_state_hci_callback(self, record):
        hcipkt = record[0]
        if not issubclass(hcipkt.__class__, hci.HCI_Event):
            return

        #State report
        if hcipkt.event_code == 0xfc:
            saved_regs, cont = struct.unpack("II", hcipkt.data[:8])
            if cont != 0:
                log.info("Receiving firmware state: regs@0x%x cont@0x%x" % (saved_regs, cont))
                self.segment_data = []
                self.segments = {}
                self.succsess = True
                self.saved_regs = saved_regs
                self.cont = cont

            else:
                if not self.succsess:
                    return
                log.info("Received fuill firmware state")

                groupName = datetime.now().strftime("internalBlue_%m.%d.%Y_%H.%M.%S")
                self.project = Project("projects/"+self.internalblue.fw.FW_NAME)
                self.project.add_group(groupName)
                self.project.deactivate_all_groups()
                self.project.set_active_group(groupName, True)
                self.project.save()
                self.project.add_symbol(groupName, "cont", self.cont|1)
                self.project.add_symbol(groupName, "get_int", symbols["get_int"])
                self.project.add_symbol(groupName, "set_int", symbols["set_int"])
                self.project.add_symbol(groupName, "saved_regs", self.saved_regs)
                for segment_addr in self.segments:
                    self.project.add_segment(groupName, "", segment_addr, "".join(self.segments[segment_addr]))

                self.project.save()

        if hcipkt.event_code == 0xfb:
            segment_addr,size,current = struct.unpack("III", hcipkt.data[:12])
            self.segment_data += [hcipkt.data[12:]]

            #Check if we have missed an HCI event
            if segment_addr + len(self.segment_data)*128 != current + 128:
                if self.succsess:
                    print( hex(segment_addr), hex(len(self.segment_data)*128), hex( current + 128))
                    log.info("Failed to receive state")
                self.succsess = False
                
            #Fully received memory dumo
            if len(self.segment_data)*128 == size:
                log.info("Received segment 0x%x - 0x%x" % (segment_addr, segment_addr+size))
                self.segments[segment_addr] = self.segment_data
                self.segment_data = []
Esempio n. 6
0
def test_project_basic(project_name):
    print("Loading project %s" % project_name)
    p = Project("projects/%s" % project_name)

    print("Set default group active")
    assert p.deactivate_all_groups()
    assert p.set_active_group("default")

    print("Save")
    assert p.save()

    print("Generating build scripts")
    assert p.create_build_scripts()

    run("make -C projects/%s" % project_name)
Esempio n. 7
0
    def load_project(self, json_file):
        qDebug("load project " + json_file)
        if not os.path.exists(json_file):
            raise Exception("project.dice not found in " + str(json_file))

        project = Project(self)
        project.path = os.path.abspath(os.path.dirname(json_file))
        project.project_config = JsonOrderedDict(json_file)

        if "projectName" in project.project_config:
            project.name = project.project_config["projectName"]

        self.project = project  # set project before using self.desk, so it can access the project
        self.desk.load_desk(project.project_config)
        project.loaded = True
        self.home.add_recent_project(project.name, json_file)
Esempio n. 8
0
    def __init__(self, app):
        """
        Initialization of the Main window. This is directly called after the
        Logger has been initialized. The Function loads the GUI, creates the
        used Classes and connects the actions to the GUI.
        """
        QMainWindow.__init__(self)

        #Build the configuration window
        self.config_window = ConfigWindow(g.config.makeConfigWindgets(), g.config.var_dict, g.config.var_dict.configspec, self)
        self.config_window.finished.connect(self.updateConfiguration)

        self.app = app

        self.ui = Ui_MainWindow()

        self.ui.setupUi(self)

        self.canvas = self.ui.canvas
        if g.config.mode3d:
            self.canvas_scene = self.canvas
        else:
            self.canvas_scene = None

        self.TreeHandler = TreeHandler(self.ui)
        self.configuration_changed.connect(self.TreeHandler.updateConfiguration)

        self.MyPostProcessor = MyPostProcessor()
        self.d2g = Project(self)

        self.createActions()
        self.connectToolbarToConfig()

        self.filename = ""

        self.valuesDXF = None
        self.shapes = Shapes([])
        self.entityRoot = None
        self.layerContents = Layers([])
        self.newNumber = 1

        self.cont_dx = 0.0
        self.cont_dy = 0.0
        self.cont_rotate = 0.0
        self.cont_scale = 1.0
Esempio n. 9
0
    def __init__(self, parent=None):
        super(Dice, self).__init__(parent)

        self.application_dir = QCoreApplication.applicationDirPath()

        self.__project = Project(
            self
        )  # used as an empty default project, replaced by load_project()
        self.__desk = None
        self.__settings = None
        self.__home = None
        qmlRegisterType(Project, "DICE", 1, 0, "Project")

        self.__theme = Theme(self)
        self.__memory = MemoryInfo(self)
        self.__error = ErrorHandler(self)
        qmlRegisterType(MemoryInfo, "DICE", 1, 0, "MemoryInfo")
        qmlRegisterType(ErrorHandler, "DICE", 1, 0, "ErrorHandler")
        qmlRegisterType(BasicWrapper, "DICE", 1, 0, "BasicWrapper")
        qmlRegisterType(Camera, "DICE", 1, 0, "Camera")

        self.__app_log_buffer = {}
        self.__app_log_write_interval = 500
        self.__app_log_writer = self.__init_log_writer()

        self.__qml_engine = None
        self.__qml_context = None
        self.__app_window = None
        self.__main_window = None

        self.__core_apps = CoreAppListModel(self)

        qmlRegisterType(CoreApp, "DICE", 1, 0, "CoreApp")
        qmlRegisterType(BasicApp, "DICE", 1, 0, "BasicApp")

        self.executor = ThreadPoolExecutor(
            max_workers=2)  # TODO: set the max_workers from a configuration

        self.core_app_loaded.connect(self.__insert_core_app,
                                     Qt.QueuedConnection)
        self.__app_candidates = None
        self.__current_loading_core_app_index = 0
        self.__load_next_core_app(
        )  # load the first core app in this thread, but the other in the executor
Esempio n. 10
0
def project_main(options, args):
    p = Project(options.projectName, allow_create=options.projectCreate)

    if options.deleteGroup:
        p.group_delete(options.deleteGroup)

    if options.loadELF:
        p.load_elf(options.loadELF,
                   load_segments=options.loadSegments,
                   load_symbols=options.loadSymbols)

    if options.symbolize:
        for addr in args[1:]:
            addr = int(addr, 0)
            name = p.symbolize(addr)
            print("0x%x = %s" % (addr, name))

    if options.show:
        p.show()
Esempio n. 11
0
def getProjectByName(projectName):
    projectPath = "projects/" + os.path.basename(projectName)
    return Project(projectPath)
Esempio n. 12
0
from multiprocessing import freeze_support

from core.project import Project

if __name__ == '__main__':
    freeze_support()
    test_proj = Project()
    test_proj.init(config_path='test_conf.ini')
    test_proj.set_log_path('logs.log')

    # test_proj.prepare_sonic_data()
    # test_proj.prepare_ammonia_data()
    test_proj.generate_turb_stats()
    # test_proj.generate_fp_grds()
    # test_proj.plot()
Esempio n. 13
0
 def test_serialization(self):
     project = Project()
     json = project.serialize()
     project2 = Project.deserialize(json)
     self.assertEqual(project, project2)
Esempio n. 14
0
 def setUp(self):
     super(TestProject, self).setUp()
     self.project = Project(title="TestProject",
                            fixedData="FixedTest",
                            movingData="MovingTest",
                            isReference=True)
Esempio n. 15
0
    if args.config is None:
        print("ERROR: Missing path to config file.")
        sys.exit(1)


    config = ProjectConfig(args.config)
    config.parse()

    print("=" * 33 + " CONFIGURATION " + "=" * 32)
    print("REPOSITORY: " + config.get_repository())
    print("BRANCH: " + config.get_repository_branch())
    print("PROJECT ROOT: " + config.get_project_root_path())
    print("WWW DIRECTORY: " + config.get_project_www_path())
    print("COMPOSE PATH: " + config.get_project_compose_path())

    project = Project(config)
    server = Server(config)
    print()

    print("=" * 31 + " STOPPING PROJECT " + "=" * 31)
    server.stop()
    print()

    print("=" * 31 + " CREATING PROJECT " + "=" * 31)
    project.create_project()
    print()

    print("=" * 31 + " CLONING PROJECT " + "=" * 32)
    project.clone_repository()
    print()
Esempio n. 16
0
from core.project import Project

t = task.Task()
t.task_name = 'Clearing'
t.task_segments[0].duration = 20

for ts in t.task_segments:
    if isinstance(ts, TaskSegment):
        print(ts.start, ts.duration)

print('Duration of Clearing is: ' + str(t.get_duration()))
print('Virtual Duration of Clearing is: ' + str(t.get_virtual_duration()))

print('')

p = Project()
p.add_task(t)

p.tasks[0].set_duration(50)

clearing = p.tasks[0]
clearing1 = clearing.task_segments[0]

clearing.split_task(clearing1, 10)

clearing.split_task(clearing.task_segments[1], 30)

print(clearing.set_duration(40))

for t in p.tasks:
    print('---')