當前位置: 首頁>>代碼示例>>Python>>正文


Python npyscreen.notify_wait方法代碼示例

本文整理匯總了Python中npyscreen.notify_wait方法的典型用法代碼示例。如果您正苦於以下問題:Python npyscreen.notify_wait方法的具體用法?Python npyscreen.notify_wait怎麽用?Python npyscreen.notify_wait使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在npyscreen的用法示例。


在下文中一共展示了npyscreen.notify_wait方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: actionHighlighted

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def actionHighlighted(self, act_on_this, keypress):
        zeek_installed, suricata_installed, filebeat_installed = zeek_profile.ProcessProfiler().is_installed, \
                                                                 suricata_profile.ProcessProfiler().is_installed, \
                                                                 filebeat_profile.ProcessProfiler().is_installed
        app_mapping = {}
        if filebeat_installed:
            if zeek_installed and suricata_installed:
                app_mapping = zeek_and_suricata_mapping
            elif zeek_installed:
                app_mapping = zeek_only_mapping
            elif suricata_installed:
                app_mapping = suricata_only_mapping

        npyscreen.notify_wait(
            act_on_this, form_color='GOODHL'
        )
        app_mapping[act_on_this]().run()
        exit(0) 
開發者ID:DynamiteAI,項目名稱:dynamite-nsm,代碼行數:20,代碼來源:agent_config_selector.py

示例2: whenPressed

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def whenPressed(self):

        if self.parent.parentApp.filebeat_config.is_kafka_output_enabled():
            self.parent.parentApp.filebeat_config.enable_logstash_output()
            output_type = 'LogStash'
        else:
            self.parent.parentApp.filebeat_config.enable_kafka_output()
            output_type = 'Kafka'

        npyscreen.notify_wait(
            'Enabling {} output mode.'.format(output_type), form_color='GOODHL'
        )
        self.parent.parentApp.filebeat_config.write_config()

        self.parent.parentApp.removeForm('MAIN')
        self.parent.parentApp.addForm('MAIN', FilebeatInstanceSettingsForm, name='FileBeat Configuration')
        self.parent.parentApp.removeForm('EDITTARGETFM')
        self.parent.parentApp.addForm('EDITTARGETFM', EditTargetsForm, name='Edit FileBeat Targets')
        self.parent.parentApp.switchForm('MAIN') 
開發者ID:DynamiteAI,項目名稱:dynamite-nsm,代碼行數:21,代碼來源:filebeat_interface_config.py

示例3: afterEditing

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def afterEditing(self):
        selected_option = self.parentApp.SELECTED_RESULT
        try:
            selection = self.parentApp.RESULTS.get(selected_option)
            if not selection:
                npyscreen.notify_wait("Please select a ROM by hitting ENTER on your selection", "Selection error")
            self.search = self.parentApp.SCRAPER_OBJ
            download_thread = ThreadDownload(selection=selection)
            download_thread.start()
            # self.download_link = self.search.get_link(selection)
            while download_thread.is_alive():
                npyscreen.notify("Please wait while Romulus downloads this ROM...", "Downloading")
            # self.d = Download()
            # self.d.download(self.download_link, platform=selection.system)
            npyscreen.notify("The ROM is now available on EmulationStation", "Success")
            self.parentApp.setNextForm('MAIN')
        except TypeError:
            npyscreen.notify_wait('Please hit ENTER on your selection to select it', 'Error') 
開發者ID:ArthurMoore85,項目名稱:pi_romulus,代碼行數:20,代碼來源:results.py

示例4: onCleanExit

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def onCleanExit(self):
        if self.do_notify:
            npyscreen.notify_wait("setup.py will exit in a moment. " + self.exit_reason, title="Warning!") 
開發者ID:GluuFederation,項目名稱:community-edition-setup,代碼行數:5,代碼來源:tui.py

示例5: on_ok

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def on_ok(self):
        try:
            self.parentApp.filebeat_config.set_agent_tag(self.agent_tag.value)
            self.parentApp.filebeat_config.write_config()
        except exceptions.InvalidAgentTag as e:
            res = npyscreen.notify_ok_cancel(
                e.message,
                form_color='DANGER',
            )
            if not res:
                return
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        self.parentApp.setNextForm(None) 
開發者ID:DynamiteAI,項目名稱:dynamite-nsm,代碼行數:17,代碼來源:filebeat_interface_config.py

示例6: on_ok

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def on_ok(self):
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        for script in self.rendered_scripts:
            if script.value:
                self.parentApp.zeek_script_config.enable_script(script.name)
            else:
                self.parentApp.zeek_script_config.disable_script(script.name)

        self.parentApp.zeek_script_config.write_config()
        self.parentApp.setNextForm(None) 
開發者ID:DynamiteAI,項目名稱:dynamite-nsm,代碼行數:14,代碼來源:zeek_script_config.py

示例7: on_ok

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def on_ok(self):
        try:
            if self.threads_text.value == '':
                self.threads_text.value = 'auto'
            int(self.threads_text.value)
        except ValueError:
            if self.threads_text.value != 'auto':
                npyscreen.notify_ok_cancel(
                    'Worker Threads must be given as an integer.',
                    form_color='DANGER'
                )
                return
        if not self.net_interface_text.value:
            npyscreen.notify_ok_cancel(
                'Network Interface cannot be blank.',
                form_color='DANGER'
            )
            return
        if self.value:
            self.parentApp.suricata_config.remove_afpacket_interface(self.value)
        self.parentApp.suricata_config.add_afpacket_interface(
            interface=self.net_interface_text.value,
            threads=self.threads_text.value,
            cluster_id=self.cluster_id.value,
            bpf_filter=self.bpf_filter.value
        )

        # Switch back to the main interface
        npyscreen.notify_wait(
            self.net_interface_text.value + ' has been updated!', form_color='GOOD'
        )
        self.parentApp.suricata_config.write_config()
        self.parentApp.removeForm('MAIN')
        self.parentApp.addForm('MAIN', SuricataInstanceSettingsForm, name='Suricata Instance Configuration')
        self.parentApp.switchForm('MAIN') 
開發者ID:DynamiteAI,項目名稱:dynamite-nsm,代碼行數:37,代碼來源:suricata_interface_config.py

示例8: on_ok

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def on_ok(self):
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        self.parentApp.setNextForm(None) 
開發者ID:DynamiteAI,項目名稱:dynamite-nsm,代碼行數:7,代碼來源:zeek_node_config.py

示例9: on_ok

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def on_ok(self):
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        for rule in self.rendered_rules:
            if rule.value:
                self.parentApp.suricata_rule_config.enable_rule(rule.name)
            else:
                self.parentApp.suricata_rule_config.disable_rule(rule.name)

        self.parentApp.suricata_rule_config.write_config()
        self.parentApp.setNextForm(None) 
開發者ID:DynamiteAI,項目名稱:dynamite-nsm,代碼行數:14,代碼來源:suricata_rule_config.py

示例10: on_ok

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def on_ok(self):
        """ Perform restoration on the backup file selected """
        if self.dir_select.value:
            npyscreen.notify_wait('In the process of restoring',
                                  title='Restoring...')
            status = self.restore(self.dirs[self.dir_select.value[0]])
            if status[0]:
                npyscreen.notify_confirm('Status of restore:\n' +
                                         status[1])
            else:
                npyscreen.notify_confirm(status[1])
            self.quit()
        else:
            npyscreen.notify_confirm('Choose a version to restore from') 
開發者ID:CyberReboot,項目名稱:vent,代碼行數:16,代碼來源:backup.py

示例11: getQR

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def getQR(self):
        if not self.parentApp.setup.showingToken:
            return
        while self.parentApp.setup.token is None:
            npyscreen.notify_wait(
                "Waiting for token...\n\nOpen Signal > Settings > Linked Devices > Add and scan the QR code.", title="Setup")
            time.sleep(0.1)
        if not self.parentApp.setup.token.startswith('tsdevice:'):
            npyscreen.notify_confirm(
            "There was not a valid registration token returned from signal-cli\n\nReturned token: {}".format(self.parentApp.setup.token), title="Setup")
            exit(0)
        return pyqrcode.create(self.parentApp.setup.token, error='L').terminal(quiet_zone=1) 
開發者ID:jwoglom,項目名稱:signal-curses,代碼行數:14,代碼來源:forms.py

示例12: run

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def run(self):
        log('message thread')

        if self.app.state.bus == 'system':
            self.bus = pydbus.SystemBus()
        else:
            self.bus = pydbus.SessionBus()

        log('waiting for ({}) dbus...'.format(self.app.state.bus))
        self.signal = exception_waitloop(self.get_message_bus, GLib.Error, 60)
        if not self.signal:
            log('dbus err')
            npyscreen.notify_wait('Unable to get signal {} bus. Messaging functionality will not function.'.format(
                self.app.state.bus), title='Error in SignalDaemonThread')
            exit(1)
        log('got dbus')
        # self.signal.onMessageReceived

        while True:
            item = self.queue.get()
            log('queue item', item)
            if 'exit' in item:
                break
            self.do_action(**item)
            self.queue.task_done()
        log('message thread exit') 
開發者ID:jwoglom,項目名稱:signal-curses,代碼行數:28,代碼來源:__init__.py

示例13: h_save_message_part

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def h_save_message_part(self, ch):
        self.parent.saveMessagePart()
        npyscreen.notify_wait("Message part saved to your downloads folder: \n %s" % self.parent.DOWNLOAD_DIR) 
開發者ID:sealingtech,項目名稱:EDCOP,代碼行數:5,代碼來源:stdfmemail.py

示例14: on_ok

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def on_ok(self):
        """
        Take the tool selections and add them as plugins
        """
        def diff(first, second):
            """
            Get the elements that exist in the first list and not in the second
            """
            second = set(second)
            return [item for item in first if item not in second]

        def popup(original_tools, branch, thr, title):
            """
            Start the thread and display a popup of the tools being added until
            the thread is finished
            """
            thr.start()
            tool_str = 'Adding tools...'
            npyscreen.notify_wait(tool_str, title=title)
            while thr.is_alive():
                tools = diff(ManifestTools(), original_tools)
                if tools:
                    tool_str = ''
                for tool in tools:
                    pre_tool = 'Added: ' + branch + '/' + tool + '\n'
                    tool_str = pre_tool + tool_str
                npyscreen.notify_wait(tool_str, title=title)
                time.sleep(1)
            return

        original_tools = ManifestTools()
        for branch in self.tools_tc:
            tools = []
            for tool in self.tools_tc[branch]:
                if self.tools_tc[branch][tool].value:
                    # get rid of temporary show for multiple tools in same
                    # directory
                    if tool == '/':
                        tools.append(('.', ''))
                    else:
                        tools.append((tool, ''))
            repo = self.parentApp.repo_value['repo']
            version = self.parentApp.repo_value['versions'][branch]
            api_action = Tools(version=version, branch=branch)
            thr = threading.Thread(target=api_action.new, args=(),
                                   kwargs={'tool_type': 'repo',
                                           'uri': repo,
                                           'tools': tools})
            popup(original_tools, branch, thr,
                  'Please wait, adding tools for the ' + branch + ' branch...')
        npyscreen.notify_confirm('Done adding repository: ' +
                                 self.parentApp.repo_value['repo'],
                                 title='Added Repository')
        self.quit() 
開發者ID:CyberReboot,項目名稱:vent,代碼行數:56,代碼來源:choose_tools.py

示例15: handleEnvelope

# 需要導入模塊: import npyscreen [as 別名]
# 或者: from npyscreen import notify_wait [as 別名]
def handleEnvelope(self, env):
        self.envelopes.append(env)

        if env.timestamp and (time.time() - env.epoch_ts) >= 60:
            log('ignoring envelope due to time difference of',
                str((time.time() - env.epoch_ts)))
            return

        if env.dataMessage.is_message():
            if self.state.shouldDisplayEnvelope(env):
                self.addEnvelope(env)
            elif self.state.shouldNotifyEnvelope(env):
                log('notifying line')
                gen_line = env.gen_line()
                txt = '{}:\n\n{}'.format(gen_line[0], gen_line[2])
                if env.group:
                    txt = 'Group: {}\n'.format(json.dumps(env.group)) + txt
                npyscreen.notify_wait(
                    txt, title='New Message from {}'.format(gen_line[1]))
            else:
                log('not displaying or notifying dataMessage')

        if env.syncMessage.is_read_message():
            log('is read message', env.syncMessage)
            for e in self.envelopes[:-1]:
                if env.syncMessage.sync_read_matches(e):
                    log('mark_read', e)
                    self.markAsEnvelope(e, '(read)')

        if env.callMessage.is_offer():
            self.app.wMain.addValues([
                ('*', 'You are receiving an inbound call from {}'.format(env.source))
            ])
            npyscreen.notify_wait(
                'You are receiving an inbound call', title='Call from {}'.format(env.source))

        if env.callMessage.is_busy():
            self.app.wMain.addValues([
                ('*', 'The caller {} is busy'.format(env.source))
            ])
            npyscreen.notify_wait('The caller is busy',
                                  title='Call from {}'.format(env.source))

        if env.callMessage.is_hangup():
            self.app.wMain.addValues([
                ('*', 'The caller {} hung up'.format(env.source))
            ])
            npyscreen.notify_wait('The caller hung up',
                                  title='Call from {}'.format(env.source)) 
開發者ID:jwoglom,項目名稱:signal-curses,代碼行數:51,代碼來源:__init__.py


注:本文中的npyscreen.notify_wait方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。