def __init__(self, parent): tk.Frame.__init__(self, parent) self.create_ui() self.name = StringVar() self.phone = StringVar() self.birthday = StringVar() self.book = contact.ContactBook() self.load_table() self.grid(sticky=(tk.N, tk.S, tk.W, tk.E), columnspan=8) parent.grid_rowconfigure(0, weight=1) parent.grid_columnconfigure(0, weight=1) Label(parent, text="Name").grid(row=1, column=0, sticky=W) Entry(parent, textvariable=self.book.name, width=20).grid(row=1, column=1) Label(parent, text="Phone").grid(row=1, column=2, sticky=W) Entry(parent, textvariable=self.book.phone, width=20).grid(row=1, column=3) Label(parent, text="Birthday").grid(row=1, column=4, sticky=W) Entry(parent, textvariable=self.book.birthday, width=20).grid(row=1, column=5) Button(parent, text="Add", command=self.process_add).grid(row=1, column=6) Button(parent, text="Delete", command=self.process_delete).grid(row=1, column=7) notifier_obj = notifier.Notifier(self.book.contacts) notifier_obj.notifier_thread.start()
def __init__(self): self.CLASSNAME = "q3anotifier" self.QUAKEPATH = "" self.defaultmap = "q3dm17" self.cmd_extra_args = "" self.timeout = 3 self.project_page = "http://code.google.com/p/q3anotifier" self.version = "beta3a" self.check_if_already_running() self.configure() if (self.timeout < 3): self.timeout = 3 evt_gui_ready = threading.Event() myGUI = notifier.Notifier(self.QUAKEPATH, None, 1, evt_gui_ready, self) myPooler = pooler.Pooler(timeout=self.timeout) myPooler.register_Notifier(myGUI) myGUI.start() evt_gui_ready.wait() myPooler.start() myGUI.join() myPooler.finish() myPooler.join()
def main(): log = logger.Logger().get_logger() log.info("Starting application...") arguments_parser = argumentsparser.ArgumentsParser(log) arguments = arguments_parser.parse(setup_arguments()) client = apiclient.ApiClient(log, arguments) notifier_object = notifier.Notifier(log, arguments) condition_checker = conditionchecker.ConditionChecker( log, client, notifier_object) while True: for queue in arguments["server_queues"]: arguments["server_queue"] = queue queue_conditions = arguments["conditions"][queue] if queue_conditions["conditions_ready_queue_size"] is not None \ or queue_conditions["conditions_unack_queue_size"] is not None \ or queue_conditions["conditions_total_queue_size"] is not None \ or queue_conditions["conditions_queue_consumers_connected"] is not None: condition_checker.check_queue_conditions(arguments) generic_conditions = arguments["generic_conditions"] if generic_conditions["conditions_nodes_running"] is not None \ or generic_conditions["conditions_node_memory_used"] is not None: condition_checker.check_node_conditions(arguments) if generic_conditions["conditions_open_connections"] is not None: condition_checker.check_connection_conditions(arguments) if generic_conditions["conditions_consumers_connected"] is not None: condition_checker.check_consumer_conditions(arguments) time.sleep(arguments["server_check_rate"])
def notifier_func(*args, **kwargs): logger.info('notifier thread started') try: notifr = notifier.Notifier() while True: msg = kwargs['queue'].get() logger.debug('received a new message on notification queue: "{}"'.format(msg)) try: notifr.notify(msg=msg) except errors.DataValidationError as e: print('Data Validation Error: {}'.format(e)) except errors.PontiacError as e: print('Pontiac Error. type: "{}", {}'.format(type(e), e)) logger.info('notifier thread finished')
def create_server(current_dir, config, player_factories): httpport = config.get("http-port", 3344) cardsfile = config.get("cards-file", "cards.txt") use_card_service = config.get("use-card-service", False) log = config.get("log", False) notifierx = notifier.Notifier() players = [] for factory in player_factories: try: players += [factory(notifierx.notify)] except: print "Not starting player: " + str(factory) return Server(current_dir, cardsfile, log, httpport, notifierx, use_card_service, players)
def main(): """Shows basic usage of the Google Calendar API. Creates a Google Calendar API service object and outputs a list of the next 10 events on the user's calendar. """ credentials = get_credentials() http = credentials.authorize(httplib2.Http()) service = discovery.build('calendar', 'v3', http=http) n = notifier.Notifier() signal.signal(signal.SIGINT, create_handler(n)) while True: events = event_poll(service) handle_events(n, events) time.sleep(1 * 60)
def __init__(self, parent): super(QWidget, self).__init__(parent) self.layout = QVBoxLayout(self) #Initializing tab screen self.tabs = QTabWidget() self.tab1 = contest.Contests(self) self.tab2 = search.Search(self) self.tab3 = notifier.Notifier(self, parent) self.tab4 = settings.Settings(self, parent) self.tabs.resize(1000, 700) #Adding tabs self.tabs.addTab(self.tab1, string_contests) self.tabs.addTab(self.tab2, string_search) self.tabs.addTab(self.tab3, string_notifications) self.tabs.addTab(self.tab4, string_settings) self.layout.addWidget(self.tabs) self.setLayout(self.layout)
def runSpotify(): log = server.Logger(open("swisher-log.txt", "a")) sys.stdout = log print "OK" cardsfile = "cards.txt" httpport = 3344 notifierx = notifier.Notifier() use_card_service = True spotifyplayer = spotify.SpotifyPlayer() handlers = spotifyplayer.handlers() enrichers = [] actions = spotifyplayer.actions() spotifyapi = spotify.SpotifyApi() pages = [("Spotify", lambda c: spotify.SpotifySearchPage(c, spotifyapi))] services = [] current_dir = winstart.find_current_dir() instance = server.Server(current_dir, cardsfile, "cherry-log.txt", httpport, notifierx, use_card_service, handlers, enrichers, actions, pages, services) winstart.run(instance)
def createMpdController(current_dir, config, extra_pages): mpdhost = config.get("mpd-host", "localhost") mpdport = config.get("mpd-port", 6600) httpport = config.get("http-port", 3344) cardsfile = config.get("cards-file", "cards.txt") jamendo_clientid = config.get("jamendo-clientid", "") jamendo_username = config.get("jamendo-username", "") use_card_service = config.get("use-card-service", False) log = config.get("log", False) notifierx = notifier.Notifier() mpdplayerx = mpdplayer.MpdPlayer(mpdhost, mpdport, notifierx.notify) mpdsourcex = mpdsource.MpdSource(mpdplayerx.client) radiosx = radiosource.RadioSource(mpdplayerx) shellx = shell.Shell() pages = extra_pages + [ ("Mpd", lambda c: mpdsource.SearchPage(c, mpdsourcex)), ("Playlists", lambda c: mpdsource.PlaylistPage(c, mpdsourcex)), ("Radio", lambda c: radiosource.RadioPage(c, radiosx)), ] handlers = mpdsourcex.handlers() + [radiosx.play_radio] enrichers = [mpdsourcex.enrich_track] if jamendo_clientid: jamapi = jamendo.JamendoApi(jamendo_clientid) handler = jamendo.JamendoActionHandler(self.mpdplayer, jamapi) pages += [ ("Jamendo Search", lambda c: jamendo.SearchPage(c, jamapi)), ("Jamendo Radio", lambda c: jamendo.RadioPage(c, jamapi)), ("Jamendo Likes", lambda c: jamendo.LikesPage(c, jamapi, jamendo_username)), ] handlers += handler.handlers() enrichers += handler.enrichers() actions = mpdplayerx.actions() + shellx.actions() services = [mpdplayerx] instance = Server(current_dir, cardsfile, log, httpport, notifierx, use_card_service, handlers, enrichers, actions, pages, services) return instance
def handler(event, context): logger = logging.getLogger() logger.info("start") logger.info("event: %s", event) logger.info("context: %s", context) task_id = "%s/%s" % (context.request_id, uuid.uuid1()) access_token = os.environ["ACCESS_TOKEN"] email_context = { "host": os.environ["EMAIL_HOST"], "user": os.environ["EMAIL_USER"], "pass": os.environ["EMAIL_PASS"], "receiver": os.environ["EMAIL_RECEIVER"], } orgs = [os.environ["ORG"]] notifier.Notifier(task_id, access_token, email_context, orgs).run() logger.info("exit") return "ok"
def __init__(self): self.config = configparser.ConfigParser() self.config.read_file(codecs.open('settings.ini', 'r', 'utf-8')) self.serv_options = self.config['server_options'] self.password = self.serv_options['password'] self.mail = self.serv_options['mail'] self.crypto_trigger = "$" self.bot_options = self.config['bot_options'] self.quote_picker = QuotePicker(self.bot_options['quotesFilename']) self.triggers = self.bot_options['triggers'].strip().split('\n') self.input_trigger = self.bot_options['input'].strip() self.cmd_trigger = self.bot_options['cmd'].strip() self.channel = self.serv_options['channel'] self.alarm_trigger = self.bot_options['alarm'] self.timer_trigger = self.bot_options['timer'] self.nick = self.serv_options['nickName'].strip() self.help_trigger = self.bot_options['help'] self.jak_trigger = self.bot_options[ 'jak'].strip().replace('_', ' ').split('\n') self.man = self.bot_options['man'] self.greet_triggers = self.bot_options[ 'greet_triggers'].strip().split('\n') self.greet_answers = self.bot_options[ 'greet_answers'].strip().split('\n') self.bye_triggers = self.bot_options[ 'bye_triggers'].strip().split('\n') self.bye_answers = self.bot_options['bye_answers'].strip().split('\n') self.readbuffer = "" self.message_buffer = [] self.on_channel = False self.notifier = notifier.Notifier() self.url_pattern = re.compile( pattern="https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}([-a-zA-Z0-9@:%_,\+.~#?&//=]*)?") self.message_pattern = re.compile(pattern="PRIVMSG #?\w+ :") self.nick_begin = ":" self.nick_end = "!"
def __init__(self, parent=None): super(SinerjiGui, self).__init__(parent) self.setupUi(self) self.closeButton.setFocusPolicy(Qt.NoFocus) self.applyButton.setFocusPolicy(Qt.NoFocus) self.trayIcon = QSystemTrayIcon(QIcon(":/icon.png"), self) self.trayActions() ## Own custom function self.connect(self.trayIcon, SIGNAL('activated(QSystemTrayIcon::ActivationReason)'), self.trayActivated) self.trayIcon.setContextMenu(self.trayMenu) self.trayIcon.setToolTip(u"Sinerji") self.trayIcon.show() self.applyButton.setIcon(QIcon(":/buttonApply.png")) self.closeButton.setIcon(QIcon(":/buttonClose.png")) self.discoveredHosts = set() self.txtData = [] self.confdomain = [] self.synergycData = {} self.completedTop = None self.completedBottom = None self.completedRight = None self.completedLeft = None self.connected = False self.browser = None self.bus = None self.filled = None self.searched = None self.popup = None self.clientState = None self.serverState = None self.clientAndPos = [] self.serverAndIp = [] self.clientData = {} self.clientModel = QStringList() self.synergyConf = os.path.join(os.path.expanduser("~"), ".synergy.conf") self.iconNotify = "/usr/share/sinerji/images/notifyIcon.png" ### Start browsing services, and looking for synergy.conf for parsing in updateUi self.startBrowsing() self.updateUi() self.setComboBoxes() self.notifier = notifier.Notifier() self.clientDisconnect = disconnect.Disconnect(self) self.connect(self.notifier, SIGNAL("acceptServer"), self.acceptServer) self.connect(self.notifier, SIGNAL("rejectServer"), self.rejectServer) self.connect(self.clientDisconnect.disconnectButton, SIGNAL("clicked()"), self.disconnect) self.connect(self.clientDisconnect.okButton, SIGNAL("clicked()"), self.clientDisconnect.hide) self.process = QProcess() self.processOutput = QByteArray() self.process.setReadChannelMode(QProcess.MergedChannels) self.process.setReadChannel(QProcess.StandardOutput) self.connect(self.process, SIGNAL("readyReadStandardOutput()"), self.readData) self.topComboBox.addItem('') self.bottomComboBox.addItem('') self.rightComboBox.addItem('') self.leftComboBox.addItem('')
def setUp(self): self.notifier = notifier.Notifier()
def sendNotification(self, title="feedIO"): no = notifier.Notifier(title, self.status) no.feedNotification()
# Logging config config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config') if args.dev: logging_conf_path = os.path.join(config_path, 'logging-dev.yaml') else: logging_conf_path = os.path.join(config_path, 'logging-prod.yaml') with open(logging_conf_path, 'rt') as f: config = yaml.safe_load(f.read()) logging.config.dictConfig(config) # ------------------------------------------------------------------------- logger.info('UniFi monitor starting') notifier = notifierAPI.Notifier() active = True while active: try: # ----------------------------------------------------------------- # Connection to controller unifi = Unifi(args.address, args.site, args.user, args.passwd) unifi.login() # ----------------------------------------------------------------- # Check VPN previous_vpn_connections = list() while True:
def main_script(): if len(sys.argv) < 3: sys.stderr.write('Not enought arguments.\n') sys.exit(1) extension = sys.argv[1] if not extension.lower() in Mo.EXTENSIONS: sys.stderr.write('extension can only be %s.\n' % ' '.join(Mo.EXTENSIONS)) sys.exit(1) arg_files = [] for arg in sys.argv[2:]: arg_files.append(os.path.realpath(arg)) main_obj = Mo.MainObject(extension, arg_files) # start to list files before displaying the first dialog walk_thread = threading.Thread(target=main_obj.walk) walk_thread.start() app = QApplication(sys.argv) app.setWindowIcon(QIcon.fromTheme(Mo.EXTENSIONS[extension])) settings = QSettings() ### Translation process code_root = os.path.dirname(os.path.dirname(sys.argv[0])) appTranslator = QTranslator() if appTranslator.load(QLocale(), 'converter', '_', code_root + '/locale'): app.installTranslator(appTranslator) sysTranslator = QTranslator() pathSysTranslations = QLibraryInfo.location(QLibraryInfo.TranslationsPath) if sysTranslator.load(QLocale(), 'qt', '_', pathSysTranslations): app.installTranslator(sysTranslator) _translate = QApplication.translate dialog = first_dialog.FirstDialog(main_obj, settings) label = _translate('terminal', "Conversion to %s") % extension.upper() label += '\n' label += _translate( 'terminal', "Please select options in the dialog window and press Ok") label += '\n' sys.stderr.write(label) dialog.exec() if not dialog.result(): sys.exit(0) dialog.remember_settings(settings) progress_dlg = progress_dialog.ProgressDialog(main_obj, settings) main_obj.progress_dialog = progress_dlg main_obj.read_parameters(dialog.get_parameters()) main_obj.start_next_process() progress_dlg.exec() close_terminal = progress_dlg.close_terminal_at_end() settings.setValue('close_terminal', close_terminal) walk_thread.join() app.quit() notif = notifier.Notifier(main_obj) notif.notify() if main_obj.files_error_indexes: sys.stderr.write(_translate('terminal', "Some errors appears, ")) if main_obj.files_error_indexes or not close_terminal: sys.stderr.write( _translate('terminal', "Press Enter to close this terminal:")) input()