Exemple #1
0
  def simple_status(self):
    user_id, user = self.status['user'].items()[0]
    account = Account(id=user_id, name=user['name'])

    for link in self.status['link'].values():
      structure_key = link['structure']
      structure_id = clean_id(structure_key)
      struct = self.status['structure'][structure_id]
      structure = Structure(id=structure_id, name=struct['name'], location=struct['location'],
                            away=struct['away'], num_thermostats=struct['num_thermostats'])
      account.structures[structure_id] = structure

      for device_key in struct['devices']:
        device_id = clean_id(device_key)
        dev = self.status['device'][device_id]
        shared = self.status['shared'][device_id]
        mode = dev['current_schedule_mode']
        if mode == 'HEAT':
          target_temperature_low, target_temperature_high = shared['target_temperature'], None
        elif mode == 'COOL':
          target_temperature_high, target_temperature_low = shared['target_temperature'], None
        else:
          target_temperature_high = shared['target_temperature_high']
          target_temperature_low = shared['target_temperature_low']
        device = Device(id=device_id, name=shared['name'], system_mode=dev['current_schedule_mode'],
                        scale=dev['temperature_scale'], temperature=shared['current_temperature'],
                        target_temperature_low=target_temperature_low, target_temperature_high=target_temperature_high,
                        heater_on=shared['hvac_heater_state'], ac_on=shared['hvac_ac_state'],
                        fan_mode=dev['fan_mode'], fan_on=shared['hvac_fan_state'])

        structure.devices[device_id] = device
    return account
Exemple #2
0
async def _(message: types.CallbackQuery):
    await bot.answer_callback_query(message.id)
    user = user_dict[message.from_user.id]
    id = str(random.randint(1, 999999) * message.from_user.id)
    account_dict[id] = Account(id)
    user.accounts.append(id)
    account_dict[id].dnevnik = 'Сетевой город'
    user.logic = 'login'
    user.account_id = id
    await bot.send_message(
        message.from_user.id,
        'Введи логин и пароль через пробел.\nПример: ВасяПупкин ПарольВаси')
Exemple #3
0
    def __init__(self):
        super().__init__()
        self.log = Logging().logger
        self.log.debug("Kiwoom() class Start")

        self.bot = telegramBot()
        self.bot.send(text="키움 자동화 매매 프로그램이 시작되었습니다.")

        self.realType = RealType()
        self.account = Account()
        self.screen = Screen()
        self.stock = Stock()
        self.loop = Eventloop()
        self.operation_status = '3'
        self.jusikchegul = False
        self.date = str(date.today().year) + str(
            date.today().month).zfill(2) + str(date.today().day).zfill(2)

        self.get_ocx_instance()  # OCX 방식을 파이썬에 사용할 수 있게 변환해 주는 함수
        self.event_slots()  # 키움과 연결하기 위한 시그널 / 슬롯 모음
        self.real_event_slot()
        self.signal_login_commConnect()  # 로그인 요청 함수
        self.get_account_info()
        self.get_stock_info()

        QTest.qWait(1000)

        self.running()
        print("MAIN CODE IS END")
    def storeNewAccount(self):
        print(self.clickedType.get())
        if(self.clickedType.get()=='Saving'):
            print("saving")
            new = AccountSaving()
            new = new.create(self.customer_id, self.balance.get(), 0)

        if(self.clickedType.get()=='Check'):
            print("checking")
            new = AccountChecking()
            new = new.create(self.customer_id, self.balance.get(), 0)

        if(self.clickedType.get()=='Loan'):
            print("loan")
            new = AccountLoan()
            new = new.create(self.customer_id, self.balance.get(), 0, 0, 0)
        
        from tampilan.Account import Account
        self.ca.destroy()
        Account(self.customer_id)
Exemple #5
0
 def __init__(self, platform, username):
     self.account = Account(platform, username)
     self.mine_data()
Exemple #6
0
class QueryAPI:
    BASE_URL = 'http://www.bungie.net/Platform/Destiny/'
    match = []

    def __init__(self, platform, username):
        self.account = Account(platform, username)
        self.mine_data()

    def mine_data(self):
        self.get_membershipID()
        self.get_characterIDs()
        self.get_class_hash()
        return

    def get_membershipID(self):
        """
        Gets the membershipID, stores the value in the Account object.
        """
        response = requests.get(self.BASE_URL + self.account.platform +
                                "/Stats/GetMembershipIdByDisplayName/" +
                                self.account.username)
        self.account.membershipID = response.json()['Response']

    def get_characterIDs(self):
        """
        Gets the character IDs. This returns a large amount of data via json.
        search_data() method is used to parse for IDs. Values are stored in
        the Account object.
        """
        response = requests.get(self.BASE_URL + self.account.platform +
                                "/Account/" + self.account.membershipID)
        self.search_data(response.json(), "characterId")
        self.account.characterIDs = self.match
        self.clear_match()

    def get_class_hash(self):
        """
        Gets the class hash(es) for each character found. Uses search_data()
        to parse. After all the class hash(es) are found, create_characters
        is called in the Account object.
        """
        for charID in self.account.characterIDs:
            response = requests.get(self.BASE_URL + self.account.platform +
                                    "/Account/" + self.account.membershipID +
                                    "/Character/" + str(charID))
            self.search_data(response.json(), "classHash")
            self.account.create_character(str(charID), self.match[0])
            self.clear_match()

    def search_data(self, data, searched_key):
        """
        Parses the return json file. data is the json object(dict).
        searched_key is the key that you want found.
        EXAMPLE: a searched_key = "classHash" will return all the values
        of any key(s) found with that value. Issue with recursion. If
        returning muiltple values, the results are in the match list.
        """
        found = []
        for key, value in data.items():
            if key == searched_key:
                found.append(value)
            elif isinstance(value, dict):
                self.search_data(value, searched_key)
            elif isinstance(value, list):
                for item in value:
                    if isinstance(item, dict):
                        self.search_data(item, searched_key)
        if found:
            if found not in self.match:
                self.match.extend(found)
        return found

    def clear_match(self):
        """
        Clears the list match of any of the results stored from last query.
        """
        self.match = []
 def doBack(self, event):
     from tampilan.Account import Account
     self.ca.destroy()
     Account(self.customer_id)
    def __init__(self, customer_id):
        self.customer_id = customer_id
        """
            DATAS
        """
        akun = Account()
        self.akun = akun.getAccountsByCustomerId(customer_id)

        self.saldoTotal = 0

        """
            Window Configuration
        """
        self.dashroot = Tk()
        self.window_height = 700                                            #Window Height
        self.window_width = 1100                                            #Window Width
        self.screen_width = self.dashroot.winfo_screenwidth()               #Screen Width
        self.screen_height = self.dashroot.winfo_screenheight()             #Screen Height
        self.x_cordinate = int((self.screen_width/2) - (self.window_width/2))
        self.y_cordinate = int((self.screen_height/2) - (self.window_height/2))
        self.dashroot.geometry("{}x{}+{}+{}".format(self.window_width, self.window_height, self.x_cordinate, 5))     #Implement and Center Window based on Device Screen
        self.dashroot.config(bg='#00bd56')                                  #Window Background
        # self.dashroot.overrideredirect(True)                                #Remove Window Status Bar
        self.dashroot.resizable(False, False)                               #Disable Resizing Window


        """
            Image Declaration
        """
        imgExit = PhotoImage(file='tampilan/images/exit-btn.png')
        #Dashboard Icon Navbar
        dashimage = Image.open('tampilan/images/dashboard.png')
        dashImage = dashimage.resize((38, 38), Image.ANTIALIAS)
        dashboardIMG = ImageTk.PhotoImage(dashImage)
        #Account Icon Navbar
        checkImg = Image.open('tampilan/images/checkingicon.png')
        chImage = checkImg.resize((35, 35), Image.ANTIALIAS)
        accountImage = ImageTk.PhotoImage(chImage)
        #Transaction Icon Navbar
        saveImg = Image.open('tampilan/images/transfer.png')
        sImage = saveImg.resize((30, 30), Image.ANTIALIAS)
        transImage = ImageTk.PhotoImage(sImage)
        #Logout Icon Navbar
        logoutImg = Image.open('tampilan/images/logout.png')
        logImage = logoutImg.resize((30, 30), Image.ANTIALIAS)
        logoutImage = ImageTk.PhotoImage(logImage)
        #Dashboard Info Background Icon Navbar
        cusInfoImg = Image.open('tampilan/images/info-bg.png')
        cInfoImg = cusInfoImg.resize((180, 180), Image.ANTIALIAS)
        cIImg = ImageTk.PhotoImage(cInfoImg)
        #Account Info
        siIMG = Image.open('tampilan/images/savingicon.png')
        ssImg = siIMG.resize((80, 80), Image.ANTIALIAS)
        savIMG = ImageTk.PhotoImage(ssImg)
        #Balance Info
        chIMG = Image.open('tampilan/images/checkingicon.png')
        chsImg = chIMG.resize((80, 80), Image.ANTIALIAS)
        cheIMG = ImageTk.PhotoImage(chsImg)


        ##############################################################################
        ############                    SIDEBAR CONTENT                     ##########
        ##############################################################################

        navbarLabel = Label(
            self.dashroot,
            bg='#e5e5e5',
            width=30,
            height=self.window_height
        )
        navbarLabel.place(x=0,y=0)
        
        #Dashboard Icon Navbar
        dashboardNavIcon = Label(
            self.dashroot,
            image=dashboardIMG,
            bg='#e5e5e5',
            cursor='hand2'
        )
        dashboardNavIcon.place(x=15,y=25)
        dashboardNavIcon.bind("<Button>",self.bindingToDashboard)
        #Dashboard Label Navbar
        dashboardNavLabel = Label(
            self.dashroot,
            text="DASHBOARD",
            font=(
                'Segoe UI',
                16,
                BOLD
            ),
            bg='#e5e5e5',
            fg='#23374d',
            cursor='hand2'
        )
        dashboardNavLabel.place(x=55, y=25)
        dashboardNavLabel.bind("<Button>",self.bindingToDashboard)

        #Account Icon Navbar
        accNavIcon = Label(
            self.dashroot,
            image=accountImage,
            bg='#e5e5e5',
            cursor='hand2'
        )
        accNavIcon.place(x=15,y=80)
        accNavIcon.bind("<Button>",self.bindingToAccount)
        #Account Label Navbar
        accNavLabel = Label(
            self.dashroot,
            text="ACCOUNT",
            font=(
                'Segoe UI',
                16,
                BOLD
            ),
            bg='#e5e5e5',
            fg='#23374d',
            cursor='hand2'
        )
        accNavLabel.place(x=55, y=80)
        accNavLabel.bind("<Button>",self.bindingToAccount)
        
        #Transaction Icon Navbar
        transNavIcon = Label(
            self.dashroot,
            image=transImage,
            bg='#e5e5e5',
            cursor='hand2'
        )
        transNavIcon.place(x=15,y=140)
        transNavIcon.bind("<Button>",self.bindingToTranscation)
        #Transaction Label Navbar
        transNavLabel = Label(
            self.dashroot,
            text="TRANSACTION",
            font=(
                'Segoe UI',
                16,
                BOLD
            ),
            bg='#e5e5e5',
            fg='#23374d',
            cursor='hand2'
        )
        transNavLabel.place(x=55, y=140)
        transNavLabel.bind("<Button>",self.bindingToTranscation)

        #Logout Icon Navbar
        logoutNavIcon = Label(
            self.dashroot,
            image=logoutImage,
            bg='#e5e5e5',
            cursor='hand2'
        )
        logoutNavIcon.place(x=10,y=650)
        logoutNavIcon.bind("<Button>",self.doLogout)
        #Logout Label Navbar
        logoutNavLabel = Label(
            self.dashroot,
            text="LOGOUT",
            font=(
                'Segoe UI',
                16,
                BOLD
            ),
            bg='#e5e5e5',
            fg='#23374d',
            cursor='hand2'
        )
        logoutNavLabel.place(x=50, y=650)
        logoutNavLabel.bind("<Button>",self.doLogout)


        ##############################################################################
        ############                    DASHBOARD CONTENT                   ##########
        ##############################################################################

        #Customer Page Title
        cusTitle = Label(
            self.dashroot,
            text="Customer Bank System Dashboard",
            font=(
                'Segoe UI',
                20,
                BOLD
            ),
            bg='#00bd56',
            fg='#e5e5e5'
        )
        cusTitle.place(x =450, y=20)

        greetLabel = Label(
            text="Welcome to Bank Customer Management System",
            font=(
                'Segoe UI',
                16,
                BOLD
            ),
            fg='#e5e5e5',
            bg='#00bd56'
        )
        greetLabel.place(x=430, y=80)

        """
            Dashboard Info Background Graphic User Interface
        """
        accountInfoLabel = Label(
            self.dashroot,
            image=cIImg,
            border=0,
            bg='#00bd56',
        )
        accountInfoLabel.place(x=570,y=150)

        """
            Dashboard Info Icon Graphic User Interface
        """
        accountInfoIcon = Label(
            self.dashroot,
            image=savIMG,
            border=0,
            bg='#e5e5e5',
        )
        accountInfoIcon.place(x=585,y=190)

        """
            Dashboard Info Bottom Label Graphic User Interface
        """
        accountInfoBottom = Label(
            self.dashroot,
            text='Account',
            font=(
                'Segoe UI',
                16,
            ),
            bg='#e5e5e5',
            fg='#23374d'
        )
        accountInfoBottom.place(x=610,y=280)
        
        """
            Dashboard Info Number Graphic User Interface
        """
        #TODO
        accountInfoNumber = Label(
            self.dashroot,
            text=len(self.akun),
            font=(
                'Segoe UI',
                40,
                BOLD
            ),
            bg='#e5e5e5',
        )
        accountInfoNumber.place(x=670,y=190)
        
        #Exit Button Property
        exitButton = Button(
            self.dashroot,
            image=imgExit,
            border=0,
            bg='#00bd56',
            activebackground='#00bd56',
            command=self.dashroot.destroy,
            cursor='hand2'
        )
        exitButton.place(x=980, y=650)

        self.dashroot.mainloop()
 def bindingToAccount(self, event):
     self.dashroot.destroy()
     from tampilan.Account import Account
     Account(self.customer_id)