def summonNote(color): global allNotes if color == mint: anote = notes.Notes(mint, dmint, lmint, 250, -60) elif color == blue: anote = notes.Notes(blue, dblue, lblue, 350, -60) elif color == violet: anote = notes.Notes(violet, dviolet, lviolet, 450, -60) elif color == watermellon: anote = notes.Notes(watermellon, dwatermellon, lwatermellon, 550, -60) allNotes.append(anote)
def __init__(self): self.running = True self.calibrating = False self.playing = False self.keyboard = None self.verbose = False self.play_status = {key: False for key in util.scale} self.picam = camera.Camera(util.config["camera_size"]) # Window initialization FULLSCREEN self.screen = pygame.display.set_mode( (1024, 768)) #,pygame.FULLSCREEN) # Load sound objects that will be used for key press self.sound = notes.Notes() self.background = self._draw_background() self._init_calibrating() self.fgmask = None self.last_frame = None self.last_fgmask = None GameController.instance = self
import random import notes notes = notes.Notes()
inter = db.Data() while flag: for i in range(3): try: print("->Главное меню:\n->\t1) Войти в аккаунт") print("->\t2) Создать аккаунт") print("->\t3) Выход из программы") choice = input("Введите 1, 2 или 3: ") choice = choice[0] if choice == "1": log = input("Введите логин: ") pas = input("Введите пароль: ") if inter.Enter(log, pas) is True: print("Вы вошли в систему") Flag = True ntwork = notes.Notes(inter.log) while Flag: try: print("->Выберите действие:") print("->\t1) Работа с заметками") print("->\t2) Управление аккаунтом") print("->\t3) Выход из программы") com = input("Введите 1, 2 или 3: ") com = com[0] if com == "1": try: print("->Выберете действие:") print("->\t1) Создать заметку") print("->\t2) Изменить заметку") print("->\t3) Удалить заметку") print("->\t4) Удалить все заметки")
#!/usr/bin/env python3 """ Launcher for the notes.txt application. """ import sys import os from qtpy import QtWidgets # Add notes package to sys.path THISDIR = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.dirname(THISDIR)) # Now we can import it import notes # Launch! app = QtWidgets.QApplication([]) w = notes.Notes(None) w.show() app.exec_()
inter = db.Data() while flag: for i in range(3): try: print("->Главное меню:\n->\t1) Войти в аккаунт") print("->\t2) Создать аккаунт") print("->\t3) Выход из программы") choice = input("Введите 1, 2 или 3: ") choice = choice[0] if choice == "1": log = input("Введите логин: ") pas = input("Введите пароль: ") if inter.Enter(log, pas) is True: print("Вы вошли в систему") Flag = True ntwork = notes.Notes(inter.log, inter.pas) while Flag: try: print("->Выберите действие:") print("->\t1) Работа с заметками") print("->\t2) Управление аккаунтом") print("->\t3) Выход из программы") com = input("Введите 1, 2 или 3: ") com = com[0] if com == "1": try: print("->Выберете действие:") print("->\t1) Создать заметку") print("->\t2) Изменить заметку") print("->\t3) Удалить заметку") print("->\t4) Удалить все заметки")
def main(self): if (self.verbose == 1): print "==> Connecting to server " + self.host + " on port " + str(self.port) # connect to a server self.readbuffer = "" self.socket = socket.socket( ) self.socket.connect((self.host, self.port)) # register user if (self.verbose == 1): print "==> Registering nick/user information" self.socket.send("NICK %s\r\n" % self.nick) self.socket.send("USER %s %s * :%s\r\n" % (self.ident, self.host, self.realname)) # some modules require an extra initialization if "log" in self.mods: import log log = log.Log(self.config) if "notes" in self.mods: import notes notes = notes.Notes(self.home + "/notes") if not os.access(self.home + "/notes", os.F_OK | os.W_OK): os.mkdir(self.home + "/notes") # create prefs directory # main loop while 1: # join to channels if self.registered: for channel in self.channels: if not self.inChannels[channel]: self.socket.send("JOIN %s\r\n" % channel) # read buffer from server self.readbuffer = self.readbuffer + self.socket.recv(1024) data = self.readbuffer.split("\n") self.readbuffer = data.pop( ) # process every line for line in data: if (self.debug >= 2): print "[DEBUG] " + line # get sanitized string line = string.rstrip(line) line = string.split(line) # server ping pong if (line[0] == "PING"): self.socket.send("PONG %s\r\n" % line[1]) # 433 Nickname is already in use elif (line[1] == "433"): # :server.domain 433 * botijo :Nickname is already in use. self.socket.close() if (self.verbose == 1): print "==> Nickname is already in use." sys.exit() # 376 End of MOTD if line[1] == '376': if (self.verbose == 1): print "==> Successfully registered with nickname: %s." % self.nick self.registered = True # 366 End of /NAMES list if line[1] == '366': if (self.verbose == 1): print "==> Successfully joined channel: %s." % line[3] self.inChannels[line[3]] = True # private messages elif (line[1] == "PRIVMSG"): user = line[0].lstrip(":") nick = line[0].split("!")[0].lstrip(":") msg = " ".join(line[3:]).lstrip(":") tmp = msg.split(" ") sendto = "" petition = "" response = "" mod = "" # PRIVMSG from user to bot if (line[2] == self.nick): sendto = nick mod = tmp[0] petition = " ".join(tmp[1:]) # PRIVMSG from user to channel elif (line[2] in self.inChannels): sendto = line[2] if (msg[0] == "!"): mod = tmp[0].lstrip("!") petition = " ".join(tmp[1:]) # print some debug messages if (self.debug >= 2): print "[DEBUG] mods: " + " ".join(self.mods) print "[DEBUG] sendto: " + sendto print "[DEBUG] mod: " + mod print "[DEBUG] petition: " + petition # search and execute the module petition if (len(mod) > 0): if mod in self.mods: if (len(petition) > 0): tmp = petition.split(" ") cmd = tmp[0] args = " ".join(tmp[1:]) if (mod == "sysinfo"): import sysinfo mod_sysinfo = sysinfo.Sysinfo() response = mod_sysinfo.doCommand(cmd, args) elif (mod == "notes"): if user in self.admins: response = notes.doCommand(cmd, args) else: response = "you are not authorized to use this module" else: response = "module '" + mod + "' requires more arguments to be passed" # return the response with a prefix depending on PRIVMSG origin if (sendto is not "") and (response is not ""): if (sendto != nick): response = nick + ": " + response self.socket.send("PRIVMSG %s :%s\r\n" % (sendto, response)) if (self.verbose == 1): print "==> PRIVMSG " + sendto + " :" + response # save last line if log module is enabled if "log" in self.mods: if (self.debug >= 1): print "[DEBUG] log.write(" + nick + ", " + msg + ", " + sendto + ")" log.write(nick, msg, sendto) # debug not managed command codes from server else: if (self.debug >= 3): print "[DEBUG] NOT MATCHED LINE"