Beispiel #1
0
    def getDesktops(self, statusString):
        desktopList = []

        #Finding the start and end of the monitor status
        monitorStart = statusString.find(self.name)
        #Finding end of monitor. This is hard because new monitors start with 'm' or 'M' but monacle layout is
        #also indicated with an m. This means we have to find monitors in some other way.
        #All montior names have a - in them which means we can look for those
        #monitorEnd = statusString.find("-", monitorStart + len(self.name))

        #Get a substring of the monitor string
        monitorString = statusString[monitorStart:]

        #Find individual pieces
        monitorSplit = monitorString.split(":")

        #We now have an array with the current desktop layout on the monitor.
        #The first element is the name of the monitor itself which we don't want to use. The last two elements
        #are the layout and the start of the next monitor. Im not interested in those either
        monitorInfo = monitorSplit[1:-2]

        for mi in monitorInfo:
            dFocused = False

            if mi[0].lower() == "l":
                break

            #Get the status of the monitor

            #the first character is the status of the desktop
            desktopChar = mi[0]
            lc = desktopChar.lower()

            #finding the status of the desktop
            dStatus = util.dStatusDict[lc]

            if desktopChar.isupper():
                dFocused = True

            #The rest of the string is the desktop name
            dName = mi[1:]

            #Adding the desktop to the list
            desktopList.append(Desktop.Desktop(dName, dStatus, dFocused))

        return desktopList
Beispiel #2
0
def main():
    input("Press ENTER to start...")

    start_time = time.clock()

    products = [
        Laptop.Laptop(),
        Desktop.Desktop(),
        Monitor.Monitor(),
        Printer.Printer(),
        Mouse.Mouse(),
        Keyboard.Keyboard()
    ]

    for product in products:
        product.run()

    print("\n{0}s".format(time.clock() - start_time))
Beispiel #3
0
from Computador import *
from Desktop import *
from Notebook import *

tela = Desktop('Hp', 'Branco', 1.500, 100)
print("----- Desktop -----")
print(tela.getInformacoes())
tela.modelo = 'AOC'
tela.cor = "Preto"
tela.preco = 1.000
print('Dados atualizados: ')
print(tela.getInformacoes())
tela.cadastrar()

print('\n----- Notebook -----')
note = Notebook('G3', 'Prata', 5.600, 500)
print(note.getInformacoes())
note.modelo = 'Acer'
note.cor = 'Prata'
note.preco = 2.000
print('Dados atualizados: ')
print(note.getInformacoes())
note.cadastrar()