Ejemplo n.º 1
0
def main():

    loader = Loading(100, 'installing all the things.', '+')
    for count in range(1, 99):
        loader.complete(count)
        sleep(0.2)


    loader = Loading(100)
    loader.complete(10)
    sleep(1)
    loader.complete(20)
    sleep(1)
    loader.complete(30)
    sleep(1)
    loader.complete(40)
    sleep(1)
    loader.complete(50)
    sleep(1)
    loader.complete(60)
    sleep(1)
    loader.complete(70)
    sleep(1)
    loader.complete(80)
    sleep(1)
    loader.complete(90)
    sleep(1)
Ejemplo n.º 2
0
    def __init__(self, stdscr):
        self.__stdscr = stdscr
        loading = Loading(stdscr)
        loading.start()

        try:
            cred = Credentials()
            flag, email, password = cred.get_credentials()
            if not flag:
                raise Exception("Invalid credentials")
            imap = IMAP(email, password)
            folders = imap.get_mailboxes()
            options = []
            for item in folders:
                options.append({
                    'title': item.replace('"', ''),
                    'Function': EMAIL_LIST,
                    'args': (item, imap)
                })
            options.append({'title': "Back", 'Function': None, 'args': None})
            loading.stop()
            Menu(self.__stdscr, options, "Folders")

        except:
            loading.stop()
            utils.show_message(self.__stdscr,
                               "Something went wrong! Press 'q' to go back")
Ejemplo n.º 3
0
    def action(self, event):
        error = self.sizerHSave.check(self.fileNames)
        if error == '':
            if self.sizerHSave.isOverwritten():
                self.path = self.sizerHSave.getValue()
                self.path_2_network = os.path.join(self.path,
                                                   self.proj + fn_edges)
                self.path_2_nodes = os.path.join(self.path,
                                                 self.proj + fn_nodes)

                Publisher().subscribe(self.catchError,
                                      'catchError')  # create a pubsub receiver

                self.Hide()
                self.load = Loading(self, "Loading")

                self.start = time.time()
                self.callback = "postgresql_2_shpEnd"
                Publisher().subscribe(
                    self.postgresql_2_shpEnd,
                    self.callback)  # create a pubsub receiver
                Postgresql_2_shp(self.path_2_network, self.proj, 'edge_data',
                                 self.callback)
        else:
            dlg = wx.MessageDialog(self, error, 'Errors',
                                   wx.CANCEL | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
Ejemplo n.º 4
0
    def computeNewGrid(self):
        # get form values
        self.projectName = self.sizerHProject.getValue()
        self.authorName = self.sizerHAuthor.getValue()
        self.polygon = self.sizerHPolygon.getValue()
        self.obstacle = self.sizerHObstacles.getValue()
        self.srsObstacle = self.sizerHObstacles.getSRSValue()
        self.res = self.sizerHResolution.getValue()
        self.srsPolygon = self.sizerHPolygon.getSRSValue()
        self.srsPolygon = re.search(r'\[(\d*)\].*', self.srsPolygon).group(1)

        Publisher().subscribe(self.catchError,
                              'catchError')  # create a pubsub receiver
        self.tmpP = None  # path to temporary polygon files created during populate
        self.tmpO = None  # path to temporary obstacles files created during populate
        self.gridCreated = False

        self.Hide()
        self.load = Loading(self, "Loading")
        self.start = time.time()

        callback = 'populatePolygonEnd'
        Publisher().subscribe(self.populatePolygonEnd,
                              callback)  # create a pubsub receiver
        Populate(self.polygon, self.srsPolygon, self.srsProject, 'polygon',
                 callback)
Ejemplo n.º 5
0
    def __fetch_body(self, index):
        '''To fetch body of emails using imap object'''

        try:
            # start loading
            loading = Loading(self.__stdscr)
            loading.start()
            response = self.__imap.fetch_text_body(self.__index)
            self.__body = response['body']
            self.__is_attachment_present = response['is_attachment']
            self.__attachment_filenames = response['filename']

            # If attachment is_present add it in options array
            if response['is_attachment']:
                self.options.insert(0, {
                    'key': 'D',
                    'msg': 'Download Attachment'
                })
            loading.stop()
        except Exception as e:
            # To show the error message
            loading.stop()
            self.__is_error = True
            msg = "Something went wrong! Press 'q' to go back"
            self.__show_message(msg)
Ejemplo n.º 6
0
    def __init__(self, screen):
        Mode.__init__(self, screen)
        #create a loading screen
        Loading(screen)
        self.loading = True

        #border color
        self.surface.fill((0, 0, 0))

        screen.blit(self.surface, (0, 0))
        #create border at top and bottom
        self.game_dimension = (screen.get_size()[0],
                               screen.get_size()[1] * 0.75)
        self.game_surface = pygame.Surface(self.game_dimension)

        #MUST BE FIXED
        self.stage = Stage(self.game_dimension)
        self.stage.load_stage('Intro')
        self.map = self.stage.rooms[0]

        #133442__klankbeeld__horror-ambience-11.wav
        pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)

        self.fade = Fade(screen, 'in', 3)
        #add player
        self.player = Player(self.map.spawn_x, self.map.spawn_y,
                             self.map.entity)

        self.map.entity.append(self.player)
        self.shade = Shade(self.player, 0, self.fade.surface)
        #test
        self.loading = False
        self.next_before = True
Ejemplo n.º 7
0
    def action(self, event):
        fnBase = getFileNameBase(get_param_selectedProjectName(),
                                 self.sizerHNetNod.isNetwork(),
                                 fn_straightness)
        fileNames = getGeneratedFiles(fnBase)

        errorMsg = self.sizerHSave.check(fileNames)
        if errorMsg == '':
            if self.sizerHSave.isOverwritten():
                path = self.sizerHSave.getValue()
                Publisher().subscribe(self.catchError, 'catchError')
                normalized = self.sizerHNorm.isNormalized()

                self.Hide()
                self.load = Loading(self, "Computation")

                self.start = time.time()
                callback = "actionEnd"
                Publisher().subscribe(self.actionEnd,
                                      callback)  # create a pubsub receiver

                # launch computation
                if self.sizerHNetNod.isNetwork():
                    EdgeStraightness(path, fnBase, callback, normalized)
                else:
                    NodeStraightness(path, fnBase, callback, normalized)
        else:
            dlg = wx.MessageDialog(self, errorMsg, 'Errors',
                                   wx.CANCEL | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
Ejemplo n.º 8
0
Archivo: Main.py Proyecto: Joby890/LSV2
 def loadScripts(self, dir):
     import sys
     sys.path.insert(0, "./scripts")
     from Script import Script
     s = Script(self, "test")
     from loading import Loading
     l = Loading(self.segments[0])
     self.scripts.append(l)
     from TheaterChase import TheaterChase
     t = TheaterChase(self.segments[0])
     self.scripts.append(t)
     from rainbow import Rainbow
     r = Rainbow(self.segments[0])
     self.scripts.append(r)
     from LeftToRightRandom import LeftToRightRandom
     lr = LeftToRightRandom(self.segments[0])
     self.scripts.append(lr)
     from RandomLed import RandomLed
     r = RandomLed(self.segments[0])
     self.scripts.append(r)
     from Light import Light
     self.scripts.append(Light(self.segments[0]))
     from Test import Test
     self.scripts.append(Test(self.segments[0]))
     from Cycle import Cycle
     self.scripts.append(Cycle(self.segments[0]))
     from SingleColor import SingleColor
     self.scripts.append(SingleColor(self.segments[0]))
Ejemplo n.º 9
0
    def __init__(self):
        super(Preview, self).__init__()
        layout = QGridLayout(self)
        layout.setAlignment(Qt.AlignCenter)

        self.loading = Loading(200)
        self.loading.hide()
        layout.addWidget(self.loading, 0, 0)

        self.image = None
Ejemplo n.º 10
0
def callRestAsync(parent, apiName, args, callBack):
    load = Loading(parent)
    if myGlobal.serverType == 'web':
        targetFunc = callRestWithCallBack
    else:
        targetFunc = callCustomRestWithCallBack
    thread = threading.Thread(target=targetFunc,
                              args=(apiName, args, callBack, load))
    thread.setDaemon(True)
    thread.start()
    load.exec_()
Ejemplo n.º 11
0
    def action(self, event):
        wantLocal = self.sizerHRadius.isChecked()
        fnBase = getFileNameBase(get_param_selectedProjectName(),
                                 self.sizerHNetNod.isNetwork(),
                                 fn_closeness,
                                 local=wantLocal)
        fileNames = getGeneratedFiles(fnBase)

        errorMsg = ''  # reset error messages
        errorMsg += self.sizerHSave.check(fileNames)
        if wantLocal: errorMsg += self.sizerHRadius.check()
        if errorMsg == '':
            if self.sizerHSave.isOverwritten():
                path = self.sizerHSave.getValue()
                if self.sizerHRadius.isChecked():
                    radius = self.sizerHRadius.getValue()
                Publisher().subscribe(self.catchError, 'catchError')
                normalized = self.sizerHNorm.isNormalized()
                if self.isNetworkProject:
                    weighted = self.sizerHWeighted.isWeighted()
                else:
                    weighted = True if wantLocal else False
                self.Hide()
                self.load = Loading(self, "Computation")

                self.start = time.time()
                callback = "actionEnd"
                Publisher().subscribe(self.actionEnd,
                                      callback)  # create a pubsub receiver
                #launch computation
                if self.sizerHNetNod.isNetwork():
                    if wantLocal:
                        EdgeLocalCloseness(path, radius, fnBase, callback,
                                           weighted, normalized)
                    else:
                        EdgeCloseness(path, fnBase, callback, weighted,
                                      normalized)
                else:
                    if wantLocal:
                        NodeLocalCloseness(path, radius, fnBase, callback,
                                           weighted, normalized)
                    else:
                        NodeCloseness(path, fnBase, callback, weighted,
                                      normalized)

        else:
            dlg = wx.MessageDialog(self, errorMsg, 'Errors',
                                   wx.CANCEL | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
Ejemplo n.º 12
0
    def __init__(self, parent):
        super(IntroFrame, self).__init__(parent)
        layout = QVBoxLayout(self)
        layout.setContentsMargins(20, 15, 20, 20)

        self.title = Title('', 23)
        titleLayout = QHBoxLayout()
        titleLayout.setAlignment(Qt.AlignTop)
        titleLayout.addWidget(QLabel(' ' * 5))
        titleLayout.addWidget(self.title, 1)
        layout.addLayout(titleLayout, 0)

        self.loading = Loading(200)
        self.loading.hide()
        layout.addWidget(self.loading, 1, Qt.AlignCenter)
Ejemplo n.º 13
0
    def computeBC(self):
        self.Hide()
        self.load = Loading(self, "Computation")

        Publisher().subscribe(self.catchError, 'catchError')

        self.start = time.time()
        callback = "actionEnd"
        Publisher().subscribe(self.actionEnd, callback) # create a pubsub receiver

        # launch computation
        if self.sizerHNetNod.isNetwork():
            if self.sizerHImplementation.isNormal():
                EdgeBetweenness(self.path, self.fnBase, callback, self.k, self.weighted, self.normalized)
            else:
                EdgeMeanBetweenness(self.path, self.fnBase, callback, self.k, self.weighted, self.normalized)
        else:
            NodeBetweenness(self.path, self.fnBase, callback, self.k, self.weighted, self.normalized)
Ejemplo n.º 14
0
        def __init__(self):
                super(Info, self).__init__()
                layout = QGridLayout(self)
                layout.setAlignment(Qt.AlignCenter)

                self.loading = Loading(70)
                self.loading.hide()
                layout.addWidget(self.loading, 0, 0, 1, -1, Qt.AlignCenter)

                self.info = []
                font = QFont()
                font.setStyleStrategy(QFont.PreferAntialias)
                font.setPixelSize(15)
                font.setFamily('monospace')
                self.valueLabelFont = font
                font = QFont(font)
                font.setBold(True)
                self.nameLabelFont = font

                self.textTemplate = '<font color="white">%s</font>'
Ejemplo n.º 15
0
    def __init__(self, screen):
        Mode.__init__(self, screen)
        #create a loading screen
        Loading(screen)
        #now do all the intial stuff
        self.surface.fill((0, 0, 0))
        screen.blit(self.surface, (0, 0))
        #create border at top and bottom
        game_dimension = (screen.get_size()[0], screen.get_size()[1] * 0.75)
        self.game_surface = pygame.Surface(game_dimension)

        self.stage = Stage(game_dimension)
        self.stage.load_stage('round_1')
        self.map = self.stage.rooms[0]
        self.fade = Fade(screen, 'in', 3)
        #add player
        self.player = Player(self.map.spawn_x, self.map.spawn_y,
                             self.map.entity)

        self.map.entity.append(self.player)
Ejemplo n.º 16
0
    def __fetch_emails(self):
        '''To fetch emails from imap server using IMAP class'''

        try:
            # Start loading until mails are fetched
            loading = Loading(self.__stdscr)
            loading.start()
            # Select particular mailbox
            num = self.__imap.select_mailbox(self.__directory_name)

            if num == 0:
                loading.stop()
                self.__is_error = True
                msg = "Nothing in " + \
                    self.__directory_name.replace(
                        '"', '') + "!! Press 'q' to go back"
                utils.show_message(self.__stdscr, msg)
                return
            self.__num = num

            # Fetch atleast 30 mails if total mails are less than that then fetch total number of mails
            count = min(self.__num - 1, 30)
            if (self.__num - self.__fetched_emails) > 0:
                emails = self.__imap.fetch_email_headers(
                    self.__num - self.__fetched_emails, count)
                self.__fetched_emails += count + 1
                self.__main_list.extend(emails)
                self.emails = emails
            else:
                self.__is_end = True

            loading.stop()
        except Exception as e:
            # To show the error message
            loading.stop()
            self.__is_error = True
            msg = "Something went wrong! Press 'q' to go back"
            utils.show_message(self.__stdscr, msg)
Ejemplo n.º 17
0
    def __init__(self):
        super(ItemList, self).__init__()
        layout = QVBoxLayout(self)
        layout.setAlignment(Qt.AlignTop)

        self.loading = Loading(128)
        self.loading.hide()
        layout.insertWidget(0, self.loading, 10, Qt.AlignCenter)

        self.currentPage = 0
        self.prevPage = Button('###UP###', False, True, False)
        self.nextPage = Button('###DOWN###', False, True, False)
        self.prevPage.setEnabled(False)
        self.nextPage.setEnabled(False)
        self.prevPage.clicked.connect(self.showPrevPage)
        self.nextPage.clicked.connect(self.showNextPage)
        pageLayout = QHBoxLayout()
        pageLayout.setAlignment(Qt.AlignBottom)
        pageLayout.addWidget(self.prevPage)
        pageLayout.addWidget(self.nextPage)
        layout.insertLayout(ItemList.ITEM_PER_PAGE + 1, pageLayout, 1)

        self.items = {}
Ejemplo n.º 18
0
    def run(self):
        self.init()

        sm = SceneManager()

        sm.register_scene(DevicesWaiting(self.display, self.ee))

        # sm.go(SceneId.DEVICES_WAITING)
        sm.register_scene(Dummy(self.display))
        # sm.go(SceneId.DUMMY)

        sm.register_scene(Loading(self.display))
        sm.go(SceneId.LOADING)

        while (True):
            if Config.ENABLE_CLI:
                input_str = self.cli.read()
                if input_str == 'exit':
                    sm.destroy()
                    break
                self.handle_cli_command(input_str)

            time.sleep(0.01)
Ejemplo n.º 19
0
    def createNewProject(self):
        # get form values
        self.projectName = self.sizerHProject.getValue()
        self.authorName = self.sizerHAuthor.getValue()
        self.shape = self.sizerHNetwork.getValue()
        self.tol = self.sizerHTolerance.getValue()
        self.srsI = self.sizerHNetwork.getSRSValue()
        self.srsI = re.search(r'\[(\d*)\].*', self.srsI).group(1)

        Publisher().subscribe(self.catchError,
                              'catchError')  # create a pubsub receiver
        self.tmp = None
        self.topoCreated = False

        self.Hide()
        self.load = Loading(self, "Loading")

        self.start = time.time()

        cbPopEnd = "populateEnd"
        Publisher().subscribe(self.populateEnd,
                              cbPopEnd)  # create a pubsub receiver
        Populate(self.shape, self.srsI, self.srsO, self.projectName, cbPopEnd)
Ejemplo n.º 20
0
    if platform.system() == 'Windows':
        conf.read(path, encoding="utf-8-sig")
    else:
        conf.read(path)
    # 数据库实例
    stone = stoneobject()
    # 初始化 定时器
    task = Task("08:00", logger)
    times = conf.get(section="time", option="now")
    if task.times != datetime.time(int(times.split(':')[0]), int(times.split(':')[1])):
        task.times = input("请输入开始时间,例如08:00")
    # task.times = "19:45"
    logger.debug("主程序开始运行")
    # 初始化 邮件发送、短信发送
    send_mail = EmailSend(smtp_server=conf.get(section='email', option='smtp_server'),
                          smtp_port=conf.get(section='email', option='smtp_port'),
                          from_addr=conf.get(section='email', option='from_addr'),
                          from_addr_str=conf.get(section='email', option='from_addr_str'),
                          password=conf.get(section='email', option='password'),
                          error_address=conf.get(section='email', option='error_email'), logger=logger, stone=stone,
                          special=conf.items(section='关注'))
    loading = Loading(stone=stone, logger=logger, conf=conf, )
    to_address_dict = to_send_email(file_name='主管及以上名单.xlsx')
    while True:
        # 到达预定时间后,执行 BlessingPlay.play
        #  收件人需要获取
        # 使用 to_address_dict 传递 收件人字典
        task.run(WarningPlay.play, to_address=to_address_dict, logger=logger, send_mail=send_mail, loading=loading,
                 date=datetime.date.today() + datetime.timedelta(days=0))
        logger.debug("当次执行完毕")
Ejemplo n.º 21
0
os.environ["SDL_FBDEV"] = "/dev/fb1"

MODE = 'activator'
if len(sys.argv) > 1:
    argument = sys.argv[1]
    if argument == 'activator' or argument == 'master' or argument == 'slave' or argument == 'test' or argument == 'tables':
        MODE = argument
    else:
        raise Exception("Unknown argument to the program")
    if argument == 'slave':
        if len(sys.argv) < 2:
            raise Exception("Slave requires master IP")
        masterip = sys.argv[2]

print "Starting in mode: " + MODE
load_window = Loading("Loading, Please wait!")
connect_window = Loading("Connecting, Please wait!")
wait_window = Waiting()  # if MODE == 'slave' else Waiting(10)


def print_tag_callback(tag):
    print "Tag: %s" % tag


#
def activate_tag_callback(tag):
    if display_manager.active_window() != prompt:
        return
    print "Activating tag: %s" % tag
    display_manager.launch(load_window)
    res = urllib2.urlopen("http://192.168.1.10:8000/api/activate?tag=%s" %
Ejemplo n.º 22
0
 def process(self):
     self.window = Loading()
     self.window.show()
Ejemplo n.º 23
0
 def loading(self):
     self.colorWipe()
     Loading(self.stick).start()