def __init__(self, master=None):
        Window.__init__(self, master)
        #self.allVehicles  = db.getList("vehicleList")
        # Iterable lists for options. Subject to change depending on Depot/Vendor.
        self.depots = db.getList("transpoList")
        self.depotIndex = 0  # For choosing depots.
        self.depotObj = self.depots[
            self.depotIndex]  # First depot in list pre-loaded.
        self.company = self.depotObj.transporter
        self.cars = []  # Filled in as the user picks a depot.
        self.bikes = []  # And whether or not they want a car or a bike.
        self.drives = []  # Ditto above.
        self.gears = []  # And double ditto.

        # User choices with which to make a vehicle.
        self.carOrBike = 0  # 0 = Car, 1 = Bike
        self.chosenModel = None  # Index for Model Object
        self.chosenDrive = None  # Index for Drive Object
        self.chosenGears = None  # Index for Gears Object
        self.price = 0.0  # Float to hold the price for the vehicle.
        # Determined once model/depot is selected.
        self.newName = ""  # Name
        self.newDesc = ""  # Description

        # Image Directory + Icons and Images
        self.imgDir = "./img/vehicleCreator/"
        self.icons = {
            "Car": "icon_Car.png",
            "Bike": "icon_Bike.png",
            "Manual": "icon_Gears.png",
            "Automatic": "icon_Drive.png",
            "Wheel": "icon_Wheel.png"
        }
        self.vehicleCreatorControl()
    def __init__(self, master=None):
        Window.__init__(self, master)
        # Variable setup.
        self.hotels = db.getList("hotelList")
        self.hoteliers = db.getList("hotelierList")
        self.rooms = db.getList("hotelRoomList")
        self.features = db.getList("hotelFeatureList")
        self.locations = db.getList("locationList")

        self.hotelierObj = self.hoteliers[0]
        self.roomObj = self.rooms[0]
        self.locationObj = self.locations[0]
        self.featuresChosen = []

        self.priceMax = 0.0
        self.priceMin = 0.0
        self.results = []

        self.hotelSearch()
Exemple #3
0
    def __init__(self, master=None):
        Window.__init__(self, master)
        # Set up variables for searching through and adding to dropdowns, etc.
        self.flights = db.getList("flightList")
        self.airports = db.getList("airportList")
        self.airlines = db.getList("airlineList")
        self.tickets = db.getList("airTicketList")

        self.dateFromDateObj = None
        self.dateToDateObj = None
        self.airportsDep_index = -1
        self.airportsArr_index = -1
        self.airline_index = 0
        self.ticketType_index = 0
        self.priceFromFloat = 0.0
        self.priceToFloat = 0.0
        self.results = []

        self.flightSearch()
Exemple #4
0
    def __init__(self,master=None,listName=""):
        Window.__init__(self,master)
        self.master   = master
        self.name     = ""                      # User friendly variable, set below before the window runs.
        self.listName = listName                # Not a User-Friendly variable. Programming name of incoming list.
        self.list     = db.getList(listName)
        self.person   = None

        devList  = db.getAllLists()
        nameList = db.getListNames()
        i = devList.index(self.listName)
        self.name = nameList[i]

        # This window can be summoned for either Customers, or Staff.
        # It'll load them in. I'll do the bolts and bananas on this.
        if(listName in ["customerList","staffList"]):
            self.peopleWindow()
        else:
            print("Hey a sec, this isn't meant to happen.\nPlease use this with \"customerList\" or \"staffList\" please. :(")
Exemple #5
0
        def searchButtonCommand(searchString=GUI_searchString.get()):
            # This function writes all the output from the Search to the record list.
            ind = self.curInd
            name = self.listNames[ind]  # User-friendly list name.
            plist = self.allLists[ind]  # Programmer-friendly list name.
            attr = db.getDefaultAttributes()  # Load default attributes.
            attr.extend(
                self.attribs[ind])  # Load attributes for objects within list.
            self.searchList = []  # Clear the search list of objects.

            listData.delete(0, END)  # Clear current records list.
            allMatches = 0  # All counted data matches.
            allRecords = 0  # All counted records.
            GUI_matchTally.set("SEARCHING...")
            GUI_recordTally.set("")

            print("SearchButtonCommand: Starting...")
            for obj in db.getList(plist):
                # To check if the record being assessed is going to be outputted.
                goesInList = False
                matches = 0

                # Search through attributes for matching string.
                for a in attr:
                    try:
                        # Do Case Sensitivity Check
                        if (GUI_opt_matchCase.get() == 1):
                            # Lowercase all attributes, make them strings.
                            ss = str(searchString)

                            attrName = a  # Get code-friendly name of attribute
                            attrText = str(getattr(
                                obj, a))  # Get data from attribute
                        else:
                            # Lowercase all the attributes.
                            ss = str(searchString).lower()

                            attrName = a  # Get code-friendly name of attribute
                            attrText = str(getattr(
                                obj, a)).lower()  # Get data from attribute

                        # Use Python's "in" word to search through attributes.
                        if (ss in attrText and goesInList == False):
                            # Show the matching attribute and its contents full.
                            goesInList = True
                            matches += 1
                            allMatches += 1
                            allRecords += 1
                            print("Match " + str(matches) + " of Record " +
                                  str(obj) + " in " + str(attrName) + ", '" +
                                  str(attrText) + "'.")
                        elif (ss in attrText):
                            # Show the matching attribute only since we've already got a match.
                            matches += 1
                            allMatches += 1
                            print("Match " + str(matches) + " of Record " +
                                  str(obj) + " in " + str(attrName) + ".")
                    except AttributeError:
                        # Skip that attribute since it isn't set/present in object, so continue the loop.
                        continue

                # If there's a match, it goes on on the list.
                if (goesInList == True):
                    self.searchList.append(
                        obj)  # Add object to the list of returned objects.
                    listData.insert(END, str(
                        obj))  # Insert an entry for that list into the GUI.
            GUI_matchTally.set(str(allMatches) + " Matches")
            GUI_recordTally.set(str(allRecords) + " Records")
            print("SearchButtonCommand: Found " + str(allMatches) +
                  " Matches in " + str(allRecords) + " Records.")
            print("SearchButtonCommand: Finished.")