Example #1
0
def analysis_all(runid=-1, acqid=-1, mode="default"):
    setup = Setup.Setup()

    calibname = setup.get_calibname(runid, acqid)
    if calibname == None:
        msg = "No such runid/acqid, %08d, %03d" % (runid, acqid)
        if mode == "default":
            print msg
        elif mode == "auto":
            with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
                logger.logger.info(msg)
        return

    runidname = "%05d" % (runid)
    acqidname = "%03d" % (acqid)

    rawfile1 = glob.glob("%s/%s_%s*/%s_%s_%s*_dif_1_1_1.raw" %
                         (setup.BACKUPDATA_DIR, setup.RUNNAME, runidname,
                          setup.RUNNAME, runidname, acqidname))
    rawfile2 = glob.glob("%s/%s_%s*/%s_%s_%s*_dif_1_1_2.raw" %
                         (setup.BACKUPDATA_DIR, setup.RUNNAME, runidname,
                          setup.RUNNAME, runidname, acqidname))
    if (not len(rawfile1) == 1) or (not len(rawfile2) == 1):
        msg = "There is no such files, otherwise too many files : %s ; %s" % (
            rawfile1, rawfile2)
        if mode == "default": print msg
        elif mode == "auto":
            with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
                logger.logger.warning(msg)
        return
Example #2
0
def start_stream(api):
    """
    This functions streams the submissions of four subreddits: /r/Transhuman, /r/Transhumanism, /r/Singularity, and
    /r/ Futurology. At first grabs a wave of recent submissions, which can be a lot of them. After that wave, it grabs
    at real time the submissions. The functions scrapes the title of the submission and the url assocciated (as long
    the URL the submission links to is not a selfpost permalink ). The scrapped data is formatted and tweeted.
    A sleep time of 5 minutes is added after the tweet to avoid flooding the timeline and avoid reaching the api limit
    rate. Also, the function only tweets if the current day is even. This is needed to avoid flooding the timeline and
    tweeting duplicated status as the heroku slug resets every 24 hs.
    """
    reddit = Setup.setup_reddit()
    subreddits = reddit.subreddit('+'.join(SUBREDDITS))

    for submission in subreddits.stream.submissions():

        if date.today(
        ).day % 2 == 0:  # As the heroku slug resets every 24hs, to avoid a wave of repeated tweets from
            # this stream, the function tweets only every even day.

            url = submission.url
            if 'www.reddit.com' not in url and 'i.redd.it' not in url:
                if len(submission.title) > 100:
                    title = submission.title[:100] + '...'  # Needed in case it exceeds the tweeet character limit
                else:
                    title = submission.title
                try:
                    print("Tweeting data from Reddit")
                    api.update_status(
                        status=f"Check out \"{title}\" at: {url}")
                except:
                    print("No tweeting a duplicated status")
                    continue
                time.sleep(
                    300
                )  # sleeps for five minutes to avoid twitter api and reddit api limit rate
Example #3
0
def SetupUtils( env ):
	env.SharedLibrarySafe = SharedLibrarySafe
	if ( os.path.exists( 'sys/scons/SDK.py' ) ):
		import SDK
		sdk = SDK.idSDK()
		env.PreBuildSDK = sdk.PreBuildSDK
		env.BuildSDK = sdk.BuildSDK
	else:
		env.PreBuildSDK = NotImplementedStub
		env.BuildSDK = NotImplementedStub

	if ( os.path.exists( 'sys/scons/Setup.py' ) ):
		import Setup
		setup = Setup.idSetup()
		env.Prepare = setup.Prepare
		env.BuildSetup = setup.BuildSetup
		env.BuildGamePak = setup.BuildGamePak
	else:
		env.Prepare = NotImplementedStub
		env.BuildSetup = NotImplementedStub
		env.BuildGamePak = NotImplementedStub

	if ( os.path.exists( 'sys/scons/OSX.py' ) ):
		import OSX
		OSX = OSX.idOSX()
		env.BuildBundle = OSX.BuildBundle
	else:
		env.BuildBundle = NotImplementedStub
Example #4
0
 def changePic(self):
     setup = Setup.Setup()
     cmd = "nohup {0} > /dev/null 2>&1 &".format(setup.SPILL_PLOT)
     subprocess.call(cmd, shell=True)
     time.sleep(0.5)
     picname = setup.SPILL_PIC
     self.pic.setPixmap(QtGui.QPixmap(picname))
Example #5
0
    def run(self):
        setup = Setup.Setup()
        self.setserial()
        with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
            logger.logger.info("ReadThread is running")
        with open(setup.SPILL_LOG, "w") as f:
            f.write("")
        time.sleep(1)

        while True:
            line = self.serdev.readline().strip()
            current_spillnb = -1
            if "spillnum=" in line:
                result = line.split("spillnum=")
                if len(result) == 2:
                    current_spillnb = result[1].strip()
                    line_num = 0
                    with open(setup.SPILL_LOG, "r") as f:
                        line_num = len(f.readlines())
                    if line_num >= setup.SPILL_MAXLINE:
                        cmd = "sed -i \"1,{0}d\" {1}".format(
                            line_num - setup.SPILL_MAXLINE, setup.SPILL_LOG)
                        subprocess.call(cmd, shell=True)
                    with open(setup.SPILL_LOG, "a") as f:
                        f.write("%s\n" % (current_spillnb))
            self.finished.emit()
        with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
            logger.logger.warning("ReadThread is stopped")
Example #6
0
    def initUI(self):
        setup = Setup.Setup()

        # Histogram
        self.pic = QtGui.QLabel("histgram", self)
        self.pic.setGeometry(0, 0, 600, 500)
        self.pic.setPixmap(QtGui.QPixmap(setup.LAMBDA_PIC1))

        self.filewatch = QtCore.QFileSystemWatcher(self)
        self.filewatch.fileChanged.connect(self.changePic)
        self.filewatch.addPath(setup.LAMBDA_PIC1)
        self.filewatch.addPath(setup.LAMBDA_PIC2)
        self.filewatch.addPath(setup.LAMBDA_PIC3)
        self.filewatch.addPath(setup.LAMBDA_PIC4)
        self.time = datetime.datetime.today().strftime('%s')

        # Period select
        self.combo = QtGui.QComboBox(self)
        self.combo.addItem("10 min")
        self.combo.addItem("1 hour")
        self.combo.addItem("1 day ")
        self.combo.addItem("3 days")
        self.combo.activated.connect(self.changePic)

        # layout
        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.pic, 0, 0)
        layout.addWidget(self.combo, 1, 0)
Example #7
0
def test():
    Driver = DDT.ExcelDriver("../../PST_TestSteps.xlsx", "Sheet1")
    Driver1 = DDT.ExcelDriver("../../PST_TestSteps.xlsx", "Sheet2")
    Driver2 = DDT.ExcelDriver("../../PST_TestSteps.xlsx", "Sheet3")
    Log.Message(Driver1.Value[2])
    Log.Message(Driver1.Value[6])
    Setup.Setup_LoadImages(Driver1.Value[2], Driver1.Value[6])
Example #8
0
 def start_reconfigure(self):
     setup = Setup.Setup()
     with open(setup.RUNCTRL_LOG, "w") as f:
         f.write("")
     cmd = "ssh {0} systemctl restart pyrame &>> {1}".format(
         setup.SERV_DAQ, setup.RUNCTRL_LOG)
     with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
         logger.logger.info("{0}".format(cmd.replace("\n", ";")))
     res = subprocess.Popen(cmd,
                            shell=True,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)
     result = res.communicate()
     for var in result:
         with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
             logger.logger.info("{0}".format(var.replace("\n", ";")))
     cmd = "ssh {0} reconfigure.sh &>> {1}".format(setup.SERV_DAQ,
                                                   setup.RUNCTRL_LOG)
     with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
         logger.logger.info("{0}".format(cmd.replace("\n", ";")))
     res = subprocess.Popen(cmd,
                            shell=True,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE)
     result = res.communicate()
     for var in result:
         with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
             logger.logger.info("{0}".format(var.replace("\n", ";")))
Example #9
0
def SetupUtils(env):
    env.SharedLibrarySafe = SharedLibrarySafe
    if (os.path.exists('sys/scons/SDK.py')):
        import SDK
        sdk = SDK.idSDK()
        env.BuildSDK = sdk.BuildSDK
    else:
        env.BuildSDK = NotImplementedStub

    if (os.path.exists('sys/scons/Setup.py')):
        import Setup
        setup = Setup.idSetup()
        env.Prepare = setup.Prepare
        env.BuildSetup = setup.BuildSetup
        env.BuildGamePak = setup.BuildGamePak
    else:
        env.Prepare = NotImplementedStub
        env.BuildSetup = NotImplementedStub
        env.BuildGamePak = NotImplementedStub

    if (os.path.exists('sys/scons/OSX.py')):
        import OSX
        OSX = OSX.idOSX()
        env.BuildBundle = OSX.BuildBundle
    else:
        env.BuildBundle = NotImplementedStub
Example #10
0
    def initUI(self, parent):
        setup = Setup.Setup()

        self.state_wagscirun = 0
        self.state_calibration = 0
        self.state_internalrun = 0
        self.runid = 0
        self.acqid = 0
        self.calibname = ""
        self.log_totalline = 0
        self.log_lastline = 0

        self.timer1 = QtCore.QTimer(self)
        self.timer1.timeout.connect(self.check_runid)
        self.timer1.start(5000)
        self.timer2 = QtCore.QTimer(self)
        self.timer2.timeout.connect(self.check_log)
        self.timer2.start(3000)

        self.label1 = QtGui.QLabel("RunID:?????", self)
        self.label2 = QtGui.QLabel("AcqID:???", self)
        self.label3 = QtGui.QLabel("Status WAGASCI Run:%-12s" % ("Stopped"),
                                   self)
        self.label4 = QtGui.QLabel("Status Calibration:%-12s" % ("Stopped"),
                                   self)
        self.label1.setGeometry(0, 0, 10, 100)
        self.label2.setGeometry(0, 0, 10, 100)
        self.label3.setGeometry(0, 0, 10, 100)
        self.label4.setGeometry(0, 0, 10, 100)
        self.layout1 = QtGui.QGridLayout()
        self.layout1.addWidget(self.label1, 0, 0)
        self.layout1.addWidget(self.label2, 1, 0)
        self.layout1.addWidget(self.label3, 0, 1)
        self.layout1.addWidget(self.label4, 1, 1)
        self.gbox1 = QtGui.QGroupBox("")
        self.gbox1.setLayout(self.layout1)

        self.btn1 = QtGui.QPushButton("Start Run", self)
        self.btn2 = QtGui.QPushButton("Calibration", self)
        self.btn3 = QtGui.QPushButton("Stop", self)
        self.btn4 = QtGui.QPushButton("Reconfigure", self)
        self.btn5 = QtGui.QPushButton("Internal Run", self)

        self.btn1.clicked.connect(self.throw_wagasci_run)
        self.btn2.clicked.connect(self.throw_calibration)
        self.btn3.clicked.connect(self.throw_stop_script)
        self.btn4.clicked.connect(self.throw_reconfigure)
        self.btn5.clicked.connect(self.throw_internal_run)

        self.te = QtGui.QTextEdit("")
        self.te.setReadOnly(True)

        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.gbox1, 0, 0, 1, 3)
        layout.addWidget(self.btn1, 1, 0)
        layout.addWidget(self.btn5, 1, 1)
        layout.addWidget(self.btn2, 1, 2)
        layout.addWidget(self.btn3, 2, 1)
        layout.addWidget(self.btn4, 2, 0)
        layout.addWidget(self.te, 3, 0, 1, 3)
Example #11
0
 def check_log(self):
     setup = Setup.Setup()
     if not os.path.exists(setup.RUNCTRL_LOG):
         with open(setup.RUNCTRL_LOG, "w") as f:
             f.write("")
     cmd = "cat {0} | wc -l".format(setup.RUNCTRL_LOG)
     res = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
     line = int(res.communicate()[0].strip())
     if line == self.log_lastline:
         return
     elif line < self.log_lastline:
         cmd = "cat {0}".format(setup.RUNCTRL_LOG)
         res = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
         result = res.communicate()
         for i in range(len(result)):
             var = result[i]
             if i == 0:
                 if not var == None: self.te.setText("{0}".format(var))
             else:
                 if not var == None:
                     self.te.moveCursor(QtGui.QTextCursor.End)
                     self.te.insertPlainText("{0}".format(var))
     else:
         cmd = "sed -n '{0},{1}p' {2}".format(self.log_lastline + 1, line,
                                              setup.RUNCTRL_LOG)
         res = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
         for var in res.communicate():
             if not var == None:
                 self.te.moveCursor(QtGui.QTextCursor.End)
                 self.te.insertPlainText("{0}".format(var))
     self.log_lastline = line
def stop_system_all():
    setup = Setup.Setup()
    for process in setup.MANAGER_SYSTEM_LIST:
        cmd = "ps ux | grep \"{0}\" | grep -v \"grep\" | wc -l".\
                format(process)
        res = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
        result = res.communicate()[0].strip()
        if not result.isdigit():
            pass
        else:
            if int(result) != 0:
                cmd = "ps ux | grep \"{0}\" | grep -v \"grep\" | head -n 1".\
                       format(process)
                res = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
                result = res.communicate()[0].strip().split()[1]
                if not result.isdigit():
                    pass
                else:
                    cmd = "kill -9 {0}".format(result)
                    subprocess.call(cmd, shell=True)
                    with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
                        logger.logger.info(
                            "Stopped a process: {0}".format(process))
            else:
                pass
    def initUI(self, parent):
        setup = Setup.Setup()

        self.nb_monitor = len(setup.MANAGER_SYSTEM_LIST)
        self.btn = []
        for monitor in setup.MANAGER_SYSTEM_NAME:
            self.btn.append(QtGui.QPushButton(monitor, self))
        self.btnstop = QtGui.QPushButton('Stop All', self)
        self.btnstart = QtGui.QPushButton('Start All', self)

        for i in range(self.nb_monitor):
            self.btn[i].clicked.connect(lambda state, x=i: self.monitorCtrl(x))
            #self.btn[i].setText(setup.MANAGER_SYSTEM_NAME[i])
        self.btnstop.clicked.connect(self.stop_all)
        self.btnstart.clicked.connect(self.start_all)

        self.thread_state = StatusThread(self, nb_monitor=self.nb_monitor)
        self.thread_state.finished.connect(self.changeColor)
        self.thread_state.start()

        layout = QtGui.QGridLayout(self)
        for i in range(len(self.btn)):
            x = int(i % 2)
            y = int(i / 2)
            layout.addWidget(self.btn[i], y, x)
        y = int(len(self.btn) / 2) + int(len(self.btn) % 2)
        layout.addWidget(self.btnstart, y, 0)
        layout.addWidget(self.btnstop, y, 1)
Example #14
0
 def sendMail(self):
   setup = Setup.Setup()
   sub = "[wagasci e-log#%08d:%s]"%(self.elog_id,str(self.category.currentText()))
   header = "From: {0}\nTo: {1}\nSubject: {2}\nReply-To: {3}\n"\
             .format(setup.ELOG_SRC_ADDR,setup.ELOG_DST_ADDR,sub,setup.ELOG_REPLYTO)
   header += "====================\n"
   header += "This message is automatically sent from wagasci-analysis server,\n"
   header += "Do NOT reply to this address, but please ask {0}\n".format(setup.ELOG_REPLYTO)
   header += "====================\n"
   header += "Check the WAGASCI Monitor webpage.\n"
   header += "{0}\n".format(setup.KYOTO_WEB_ADDR)
   header += "----- New e-log has been submitted. -----\n"
   elogid = "%d"%(self.elog_id)
   date = "%04d/%02d/%02d %02d:%02d"%(
       self.int_year,self.int_month,self.int_day,self.int_hour,self.int_minute)
   author = str(self.author.text())
   category = str(self.category.currentText())
   subject = str(self.subject.text())
   content = str(self.content.toPlainText())
   header += "\n----\n ID: %s"%(elogid)
   header += "\n----\n Author: %s"%(author)
   header += "\n----\n Category: %s"%(category)
   header += "\n----\n Subject: %s"%(subject)
   header += "\n----\n Content: %s"%(content)
   header = "echo -e \"{0}\"".format(header)
   cmd = "{0} | sendmail -i -f {1} {2}".format(header,setup.ELOG_SRC_ADDR,setup.ELOG_DST_ADDR)
   with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
     logger.logger.info("{0}".format(cmd.replace("\n",";")))
   subprocess.call(cmd,shell=True)
Example #15
0
def PST_Train_022():
  Setup.Setup_PSTCheck()
  #Setup.Setup_InnitializeCPM()

  Setup.Setup_InnitializeVPM() 
  Setup.Setup_loadVPM()
  Setup.Setup_LoadPSTImages()
  Setup.Setup_VPMNewButton()
  
  Setup.Setup_DragPatternSortToTaskTree()
  Setup.Setup_PSTTrainPanel()
  Setup.Setup_PSTLoadDB("test")
  Setup.Setup_PSTAddLabel("train", "s[Down][Down][Enter]")
  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.PatternSortingSetup1_SortingTrainPanel.Panel.Panel2.Panel.PatternSortModelDropdown.BasicComboBoxEditor_BorderlessTextField, "wText", cmpEqual, "Sample Pattern Sort - 01 Fail")

  Setup.Setup_closeVPM()
Example #16
0
 def changePic(self):
     setup = Setup.Setup()
     if self.combo.currentIndex() == 0: picname = setup.LAMBDA_PIC1
     elif self.combo.currentIndex() == 1: picname = setup.LAMBDA_PIC2
     elif self.combo.currentIndex() == 2: picname = setup.LAMBDA_PIC3
     elif self.combo.currentIndex() == 3: picname = setup.LAMBDA_PIC4
     self.pic.setPixmap(QtGui.QPixmap(picname))
Example #17
0
def initGame(game, **kwargs):
    Log.log("Firing up Loltris version {} from {!r}".format(
        VERSION, sys.argv[0]))

    ## Run setup (will decide for itself whether or not it is necessary)
    Setup.setupFiles()

    if CENTER_WINDOW:
        os.environ["SDL_VIDEO_CENTERED"] = "1"

    pygame.font.init()
    Shared.load()

    instance = game(**kwargs)
    instance.setup()
    return instance
Example #18
0
 def getconbotime(self):
   setup = Setup.Setup()
   self.int_year   = int(self.year  .currentText())
   self.int_month  = int(self.month .currentText())
   self.int_day    = int(self.day   .currentText())
   self.int_hour   = int(self.hour  .currentText())
   self.int_minute = int(self.minute.currentText())
def rsync_cmd():
  setup = Setup.Setup()
  make_js()
  loglist = "{0}/*.png {1}/*.log {2}/*.png {2}/dq_history_time.js {3}/*.js {4}/*.png".format(
      setup.SM_LOG_DIR,
      setup.SM_LOG_DIR,
      setup.DQ_HISTORY_DIR,
      setup.ID_DIR,
      setup.SPILL_LOG_DIR)
  cmd = "ls {0}".format(loglist)
  res = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE)
  result = res.communicate()[0].strip().split()
  ziplist = ""
  cmd = "cd {0}>> /dev/null; tar zcvf {1} ./*png ./*eps>> /dev/null; cd - >> /dev/null".format(setup.SM_LOG_DIR,setup.KYOTO_LOG_ZIP)
  subprocess.call(cmd,shell=True)
  cmd = "cd {0}>> /dev/null; tar zcvf {1} ./*png>> /dev/null; cd ->> /dev/null".format(setup.DQ_HISTORY_DIR,setup.KYOTO_DQ_ZIP)
  subprocess.call(cmd,shell=True)
  cmd = "rsync -avuz {0} {1}/{2} {3}/{4} {5}:{6} &>> /dev/null"\
      .format(loglist,                             #0
          setup.SM_LOG_DIR,setup.KYOTO_LOG_ZIP,    #1 2 
          setup.DQ_HISTORY_DIR,setup.KYOTO_DQ_ZIP, #3 4
          setup.SERV_KYOTO,setup.KYOTO_WEB_LOG)    #5 6
  subprocess.call(cmd,shell=True)
  with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
    logger.logger.info("Logs are copied to Kyoto HEP server. {0}".format(cmd))
def make_js():
  setup = Setup.Setup()
  with open(setup.COPY_RUNID_FILE,"r") as f:
    runid = int(f.read())
  with open(setup.COPY_ACQID_FILE,"r") as f:
    acqid = int(f.read())
  with open("{0}/runid.js".format(setup.ID_DIR),"w") as f:
    f.write("document.write(\"Current RunID:{0}, AcqID:{1}\");".format(runid,acqid))
Example #21
0
 def gettime(self):
   setup = Setup.Setup()
   d = datetime.datetime.today()
   self.int_year   = int(d.strftime("%Y"))
   self.int_month  = int(d.strftime("%m"))
   self.int_day    = int(d.strftime("%d"))
   self.int_hour   = int(d.strftime("%H"))
   self.int_minute = int(d.strftime("%M"))
Example #22
0
def run_loop():
    setup = Setup.Setup()
    while True:
        run_now()
        msg = "Raw data are copied to the KEKCC tape region"
        with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
            logger.logger.info(msg)
        time.sleep(10800)  #3 hours
Example #23
0
 def ccc_check(self):
     setup = Setup.Setup()
     cmd = "{0}/ccc_check.sh".format(setup.CCC_SCRIPT_DIR)
     res = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,\
                                           stderr=subprocess.PIPE)
     res_out, res_err = res.communicate()
     if str(res_out).replace("\n", "") == "0% packet loss": return True
     else: return False
def PST_General_005():
  #Setup.Setup_InnitializeCPM()

  Setup.Setup_InnitializeVPM() 
  Setup.Setup_loadVPM()
  Setup.Setup_LoadPSTImages()
  Setup.Setup_VPMNewButton()
  Setup.Setup_VPMOrigin()

  Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.BaseSetupPanel_ButtonBar_.ToggleButton2.Click(True)


  Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.SwingObject("JPanel", "", 0).SwingObject("JPanel", "", 0).SwingObject("JRadioButton", "One Direction", 0).Click(True)
  Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.BaseSetupPanel_ButtonBar_.ToggleButton.ClickButton(True)
  #Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.Panel.Panel.Origin2Setup_OriginSetupPanel_1.ROIEditor.Panel.Panel.ScrollPane.Viewport.DisplayCanvas.Drag(214, 109, -23, -17)


  
  Setup.Setup_DragPatternSortToTaskTree()

#  Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.General.Panel.Panel2.Panel2.Button.ClickButton()
#  Aliases.javaw.Dialog2.RootPane.null_layeredPane.null_contentPane.OptionPane.OptionPane_buttonArea.OptionPane_button2.ClickButton()
  javaw = Aliases.javaw
  javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.General.Panel.Panel2.Panel.Button.ClickButton()
  javaw.Dialog2.RootPane.null_layeredPane.null_contentPane.OptionPane.OptionPane_buttonArea.OptionPane_button2.ClickButton()

  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.General.Panel.Panel2.Panel.TextField, "wText", cmpEqual, "")
  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.General.Panel.Panel2.Panel2.Label2, "text", cmpEqual, "0°")
 
  Setup.Setup_closeVPM()
def AdvOCR_Train_009():
    Setup.Setup_InnitializeCPM()
    Setup.Setup_InnitializeVPM()
    Setup.Setup_loadVPM()
    Setup.Setup_OCRImages()
    Setup.Setup_VPMNewButton()
    Setup.Setup_AdvOCR()
    Setup.Setup_DragAvdToTaskTree()
    Setup.Setup_VPMPropertiesTab()
    Setup.Setup_LinkSegmentation()
    #tasksTabbedPane_TaskTree_.ClickItem("Root|Image In Task|Advanced OCR|Segmentation Region = (((32,24),0°),(576,432),)")
    Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.ViewsTabbedPane.ROIEditor.Panel.Panel.ScrollPane.Viewport.DisplayCanvas.Click(
        375, 288)
    Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.ViewsTabbedPane.ROIEditor.Panel.Panel.ScrollPane.Viewport.DisplayCanvas.Keys(
        "[Del]")

    Regions.DisplayCanvas27.Check(
        Regions.CreateRegionInfo(
            Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.
            VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
            ViewsTabbedPane.ROIEditor.Panel.Panel.ScrollPane.Viewport.
            DisplayCanvas, 41, 47, 572, 408, False), False, False, 1000)

    #  Setup.Setup_VPMPropertiesTab()
    ##  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.ViewsTabbedPane.ROIEditor.Panel.Panel.ScrollPane.Viewport.DisplayCanvas.roiList_.elementData_2.Items[0], "xLocation_", cmpEqual, 32)
    ##  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.ViewsTabbedPane.ROIEditor.Panel.Panel.ScrollPane.Viewport.DisplayCanvas.roiList_.elementData_2.Items[0], "yLocation_", cmpEqual, 24)
    #
    ##  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane2.Panel.PropertiesScrollPane.Viewport.PropertyTable.wValue[9, "E"].origin_.angle_, "value_", cmpEqual, 0)
    ##  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane2.Panel.PropertiesScrollPane.Viewport.PropertyTable.wValue[9, "E"].origin_.reference_.element_.point_.x_, "value_", cmpEqual, 32)
    ##  aqObject.CheckProperty(Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane2.Panel.PropertiesScrollPane.Viewport.PropertyTable.wValue[9, "E"].origin_.reference_.element_.point_.y_, "value_", cmpEqual, 24)
    #
    aqObject.CheckProperty(
        Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.
        HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
        DetailComponent_BottomComponent_.PropertiesTabbedPane2.Panel.
        PropertiesScrollPane.Viewport.PropertyTable.wValue[8, "E"].point_.x_,
        "value_", cmpEqual, 331.5)
    aqObject.CheckProperty(
        Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.
        HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
        DetailComponent_BottomComponent_.PropertiesTabbedPane2.Panel.
        PropertiesScrollPane.Viewport.PropertyTable.wValue[8, "E"].point_.y_,
        "value_", cmpEqual, 255.5)

    Setup.Setup_closeVPM()
Example #26
0
def PST_Train_001():
    #Setup.Setup_InnitializeCPM()

    Setup.Setup_InnitializeVPM()
    Setup.Setup_loadVPM()
    Setup.Setup_LoadPSTImages()
    Setup.Setup_VPMNewButton()

    Setup.Setup_DragPatternSortToTaskTree()
    Setup.Setup_PSTTrainPanel()
    aqObject.CheckProperty(
        Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.
        HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
        DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.
        BaseSetupPanel_1.Panel.Panel.
        PatternSortingSetup1_PatternSortingSetupPanel_1.ROIEditor.Panel.Panel.
        ScrollPane.Viewport.DisplayCanvas.calImage_, "height_", cmpEqual, 494)
    aqObject.CheckProperty(
        Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.
        HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
        DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.
        BaseSetupPanel_1.Panel.Panel.
        PatternSortingSetup1_PatternSortingSetupPanel_1.ROIEditor.Panel.Panel.
        ScrollPane.Viewport.DisplayCanvas.calImage_, "width_", cmpEqual, 650)
    aqObject.CheckProperty(
        Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.
        HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
        DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.
        BaseSetupPanel_1.Panel.Panel.
        PatternSortingSetup1_PatternSortingSetupPanel_1.ROIEditor.Panel.Panel.
        ScrollPane.Viewport.DisplayCanvas.calImage_.wtImage_.wt_.imageName,
        "OleValue", cmpEqual, "/cf/Images/Sample Pattern Sort - 01 Fail.png")

    Setup.Setup_closeVPM()
Example #27
0
def PST_Train_012():
  #Setup.Setup_InnitializeCPM()

  Setup.Setup_InnitializeVPM() 
  Setup.Setup_loadVPM()
  Setup.Setup_LoadPSTImages()
  Setup.Setup_VPMNewButton()
  
  Setup.Setup_DragPatternSortToTaskTree()
  Setup.Setup_PSTTrainPanel()
  Setup.Setup_PSTNewDBSet("new", None)
  aqObject.CheckProperty(Aliases.javaw.Dialog4.RootPane.null_layeredPane.null_contentPane.PatternSortingSetup1_SortingTrainPanel_1_1.ToolBar.WindowsFileChooserUI_2, "wText", cmpEqual, "PST")
  Setup.Setup_PSTNewDBSet(None, "cancel")
  Setup.Setup_closeVPM()
def AdvOCR_Train_078():
    Setup.Setup_InnitializeCPM()
    Setup.Setup_InnitializeVPM()
    Setup.Setup_loadVPM()
    Setup.Setup_OCRImages()
    Setup.Setup_VPMNewButton()
    Setup.Setup_AdvOCR()
    javaw = Aliases.javaw
    textField1 = javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.HOG_OCRSetup_HOGTrainPanel.Panel3.Panel.Panel.Panel.Panel2.Panel.TextField
    textField1.Click(True)
    textField1.Keys("[BS]20[Enter]")
    textField2 = javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.HOG_OCRSetup_HOGTrainPanel.Panel3.Panel.Panel.Panel.Panel2.Panel.TextField2
    textField2.Click(True)
    textField2.Keys("[BS]99[Enter]")
    Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.HOG_OCRSetup_HOGTrainPanel.Panel3.Panel.Panel.Panel.Panel2.Panel.Button.ClickButton(
    )
    aqObject.CheckProperty(
        Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.
        HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
        DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.
        BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.
        HOG_OCRSetup_HOGTrainPanel.Panel3.Panel.Panel.Panel.Panel2.Panel.
        TextField, "wText", cmpEqual, "6")
    aqObject.CheckProperty(
        Aliases.javaw.VpmFrame.RootPane.null_layeredPane.null_contentPane.VPM.
        HideableTabbedPane.SplitPane.DetailComponent.DetailComponent_1.
        DetailComponent_BottomComponent_.PropertiesTabbedPane.Panel.Setup.
        BaseSetupPanel_1.ScrollPane.Viewport.Panel.Panel.ToolSetupCardPanel.
        HOG_OCRSetup_HOGTrainPanel.Panel3.Panel.Panel.Panel.Panel2.Panel.
        TextField2, "wText", cmpEqual, "9")

    Setup.Setup_closeVPM()
def process_loop_tmp():
    setup = Setup.Setup()
    while True:
        d = datetime.datetime.today()
        current_hour = d.strftime("%H")
        if current_hour == "03":
            cmd = "%s &>> %s" % (setup.PROCESS_DQHISTORY, setup.ANAHIST_LOG)
            subprocess.call(cmd, shell=True)
        time.sleep(1000)
Example #30
0
 def stop_alarm(self,i=-1,logger=None):
   setup = Setup.Setup()
   if not (i>-1 and i<len(self.btn)): return
   if not setup.ALARM_LIST[i] in self.thread_sound.alarm_type: return
   self.alarm_stopped[i] = True
   for tmp in range(self.thread_sound.alarm_type.count(setup.ALARM_LIST[i])): 
     self.thread_sound.alarm_type.remove(setup.ALARM_LIST[i])
   with Logger.Logger(setup.SLOWMONITOR_LOG) as logger:
     logger.logger.info("Stop alarm: {0}: timestamp={1}".format(setup.ALARM_LIST[i],self.lasttime_reset))
Example #31
0
 def kill_timer(self, parent=None):
     setup = Setup.Setup()
     self.timer.stop()
     self.btnstart.setStyleSheet("")
     self.btnstart.setText("Start")
     self.btnstop.setStyleSheet("background-color: %s" %
                                (setup.CCC_COL_BTN_OFF))
     self.btnstop.setText("Stopped")
     parent.setBtnEnable(True)
Example #32
0
def SetupUtils( env ):
	env.SharedLibrarySafe = SharedLibrarySafe
	try:
		import SDK
		env.BuildSDK = SDK.BuildSDK
	except:
		env.BuildSDK = NotImplementedStub
	try:
		import Setup
		setup = Setup.idSetup()
		env.BuildSetup = setup.BuildSetup
	except:
		env.BuildSetup = NotImplementedStub
Example #33
0
def SetupUtils( env ):
	gamepaks = idGamePaks()
	env.BuildGamePak = gamepaks.BuildGamePak
	env.SharedLibrarySafe = SharedLibrarySafe
	try:
		import SDK
		sdk = SDK.idSDK()
		env.PreBuildSDK = sdk.PreBuildSDK
		env.BuildSDK = sdk.BuildSDK
	except:
		print 'SDK.py hookup failed'
		env.PreBuildSDK = NotImplementedStub
		env.BuildSDK = NotImplementedStub
	try:
		import Setup
		setup = Setup.idSetup()
		env.BuildSetup = setup.BuildSetup
	except:
		print 'Setup.py hookup failed'
		env.BuildSetup = NotImplementedStub
Example #34
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

import xorn.storage, Setup

rev0, rev1, rev2, rev3, ob0, ob1a, ob1b = Setup.setup()

def assert_object_type(rev, ob, expected_type):
    if expected_type is not None:
        assert type(rev.get_object_data(ob)) == expected_type
        return

    try:
        rev.get_object_data(ob)
    except KeyError:
        pass
    else:
        raise AssertionError

assert_object_type(rev0, ob0, None)
assert_object_type(rev0, ob1a, None)
Example #35
0
def create(self, notebook):
	Setup.setup_profile_check(self)
	self.window.set_size_request(450,310)   # TODO Correct size

	# Frame - Select Profile Frame
	select_profile_frame = create_page(self, notebook, 'Select Profile', 100, 75)


		# Select Profile Window (scrolled)
	select_profile_window = gtk.ScrolledWindow()
	select_profile_window.set_border_width(10)
	select_profile_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
	select_profile_window.show()
	select_profile_frame.add(select_profile_window)
			# Select Profile ListStore
			  # Profile Name       = String
 	self.select_profile_liststore = gtk.ListStore(str,str)
	self.select_profile_treeview = gtk.TreeView(self.select_profile_liststore)
	select_profile_column_1 = gtk.TreeViewColumn('Profile')
	self.select_profile_treeview.append_column(select_profile_column_1)
	select_profile_window.add(self.select_profile_treeview)
	self.select_profile_treeview.show()

	for i in range(0,len(self.profiles)):
		self.select_profile_liststore.append([self.profiles[i],self.ini[i]])


		# Add Mouse Click event to select_profile_treeview
	self.select_profile_treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK)
	self.select_profile_treeview.connect('event',profile_selection, self)

        	# create a CellRenderers to render the data
        self.cell1  = gtk.CellRendererText()

        	# set background color property
        self.cell1.set_property('cell-background', 'white')

        	# add the cells to the columns
	select_profile_column_1.pack_start(self.cell1, False)

        	# set the cell attributes to the appropriate liststore column
        select_profile_column_1.set_attributes(self.cell1, text=0)


	# INSTALL SETUP INFO
	if sys.platform != 'win32':
		install_types = GLOBAL.LINUX_INSTALL_TYPES
		install_types_default = GLOBAL.LINUX_INSTALL_TYPES_DEFAULT
	else:
		install_types = GLOBAL.WINDOWS_INSTALL_TYPES
		install_types_default = GLOBAL.WINDOWS_INSTALL_TYPES_DEFAULT


	# Frame - Create Profile Frame
	create_profile_frame = create_page(self, notebook, 'Create Profile', 100, 75)

		# Table
	create_profile_table = gtk.Table(rows=1,columns=1, homogeneous=False)
	create_profile_table.show()
	create_profile_frame.add(create_profile_table)

			# Profile Name
	profile_name_label = label_create("Profile Name")
	self.profile_name = gtk.Entry(max=0)
	self.profile_name.show()
	create_profile_table.attach(profile_name_label, 0,1,0,1, gtk.FILL,gtk.FILL,10,10)
	create_profile_table.attach(self.profile_name, 1,2,0,1, gtk.FILL,gtk.FILL,10,10)
			# Install Type
	install_type_label = label_create("Install Type")
	self.install_type_combobox = combobox_setup(None, None, None, install_types_default, install_types)
	self.install_type_combobox.connect("changed", install_type_selection, self)
	create_profile_table.attach(install_type_label, 0,1,1,2, gtk.FILL,gtk.FILL,10,10)
	create_profile_table.attach(self.install_type_combobox, 1,2,1,2, gtk.FILL,gtk.FILL,10,10)
			# Spring Binary
	spring_binary_label = label_create('Spring Binary')
	self.spring_binary = gtk.Entry(max=0)
	self.spring_binary.set_text('spring')
	self.spring_binary.show()
	create_profile_table.attach(spring_binary_label, 0,1,2,3, gtk.FILL,gtk.FILL,10,10)
	create_profile_table.attach(self.spring_binary, 1,2,2,3, gtk.FILL,gtk.FILL,10,10)
			# Datadir Location
	self.spring_datadir_label = label_create('Spring Datadir')
	self.spring_datadir = gtk.Entry(max=0)
	self.spring_datadir.show()
	create_profile_table.attach(self.spring_datadir_label, 0,1,3,4, gtk.FILL,gtk.FILL,10,10)
	create_profile_table.attach(self.spring_datadir, 1,2,3,4, gtk.FILL,gtk.FILL,10,10)
			# Spring-GUI Background
	background_label = label_create('Spring GUI Background')
	self.background = gtk.Entry(max=0)
	self.background.show()
	create_profile_table.attach(background_label, 0,1,4,5, gtk.FILL,gtk.FILL,10,10)
	create_profile_table.attach(self.background, 1,2,4,5, gtk.FILL,gtk.FILL,10,10)
				# Default -> Background
	if os.path.isfile (GLOBAL.SPRING_GUI_BACKGROUND):
		self.background.set_text(GLOBAL.SPRING_GUI_BACKGROUND)


			# Button -> Save
	save_button = gtk.Button(label=None, stock=gtk.STOCK_SAVE)
	save_button.connect("clicked", Setup.profile_save, self)
	save_button.show()
	create_profile_table.attach(save_button, 2,3,0,1, 0,0,0,0)

			# Button -> Spring Binary
	spring_binary_button = gtk.Button(label=None, stock=gtk.STOCK_OPEN)
	spring_binary_button.connect("clicked", spring_binary_location, self)
	spring_binary_button.show()
	create_profile_table.attach(spring_binary_button, 2,3,2,3, 0,0,0,0)

			# Button -> Spring GUI Background
	background_button = gtk.Button(label=None, stock=gtk.STOCK_OPEN)
	background_button.connect("clicked", spring_gui_background_location, self)
	background_button.show()
	create_profile_table.attach(background_button, 2,3,4,5, 0,0,0,0)

	# Default Selection
	install_type_selection(self.install_type_combobox, self)
from Server import server
from serial import SerialException


# The following while loop keeps restarting the program if there is an error
# It will stop if errors occur too frequently

FREQ_LIMIT = 4     # limit on frequency of errors in seconds

START = 0

DELTA = FREQ_LIMIT  # done so first error doesn't count towards limit

while DELTA >= FREQ_LIMIT:
    try:
        Setup.setup()
        try:
            Setup.serial_setup()
        except SerialException:
            print "serial error"
            time.sleep(2)
            if var.serial_start == 0:
                var.serial_start = 2
            elif var.serial_start ==2:
                var.serial_start = 0
            Setup.closedown()
            Setup.serial_setup()
        SCHED = Scheduler()
        SCHED.new(server(var.port))
        SCHED.mainloop()
        
from serial import SerialException


# The following while loop keeps restarting the program if there is an error
# It will stop if errors occur too frequently

FREQ_LIMIT = 4     # limit on frequency of errors in seconds

START = 0

DELTA = FREQ_LIMIT  # done so first error doesn't count towards limit

while DELTA >= FREQ_LIMIT:
    try:
        try:
            Setup.setup()
            Setup.serial_setup()
        except StandardError:
            print "serial setup error"
            time.sleep(2)
            if var.serial_start == 0:
                var.serial_start = 1
            elif var.serial_start ==1:
                var.serial_start = 0
            Setup.setup()
            Setup.serial_setup()
        SCHED = Scheduler()
        SCHED.new(server(var.port))
        SCHED.mainloop()
        
    except StandardError: