diff --git a/GUI.py b/GUI.py index 8707a9766399995411bfb7065a6df8889a4f0891..f69e76025e79d4db775ac01841a8811b909a9497 100644 --- a/GUI.py +++ b/GUI.py @@ -1,5 +1,5 @@ from tkinter import Tk, Frame, Label, Entry, Button, messagebox -from main import * +from .main import * # Initialize main window window = Tk() @@ -59,10 +59,11 @@ def gui_login(): else: # remove else and message box when login function is finished. messagebox.showinfo("Login", "Login successful!") # function call "loginAttempt()" from main.py - user = loginAttempt(username=username, password=password) - if user == None: - # escape function - pass + user = None + while user == None: + user = loginAttempt(username=username, password=password) + if user != None: + break # Make rows and columns in the main window expand to center the form frame window.grid_rowconfigure(0, weight=1) diff --git a/main.py b/main.py index 274f789e03041296a397c339e33167ef5c549e38..a505e980ee214beb53c6f2f989ae1feb8359d845 100644 --- a/main.py +++ b/main.py @@ -33,8 +33,10 @@ def loginAttempt(username, password): Returns: staffUser: _description_ + or + None """ - pass + return True # testing passthrough def logout(): @@ -46,7 +48,7 @@ def load_cinema(): def save(): pass -def main() -> None: +def cli_main() -> None: print("\n\nSTARTING CINEMA MANAGEMENT SYSTEM.\n\n\n\n") user = None while user == None: @@ -60,14 +62,32 @@ def main() -> None: print("successful login, loading menue...") # load user # load cinema/s that user is linked to + #cinema = Cinema() # display options - # listings: - # get from cinema the listings and display film data. - # create booking: - # create booking obj and display attributes for selection - # save booking to cinema and db + selection = input("Menue options:\n\ + 1. Veiw Listings \n\ + 2. Create booking \n\ + 3. Logout \n\ + please return a number to select: ") + # switch case: + if selection == "1": + print("1") + # get from cinema the listings and display film data in dict/jason + # user.veiwFilmListings() + # format and display data + pass + elif selection == "2": + print("2") + # create booking obj and display attributes for selection + # save booking to cinema and db + # user.createBooking() + pass + elif selection == "3": + print("3") + #user.logout() + pass # following code will only execute if run directly from this file. if __name__ == "__main__": - main() \ No newline at end of file + cli_main() \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py index 656f66895193b19723f1ef3b2dcf9bc80e34ac55..d3718c6aaa5bd127244cf3a43ced4feb15e3050e 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -8,4 +8,13 @@ from .screenObj import * from .constants import * from .dbfunc import * -__all__ = ["adminUser", "cinemaObj", "managerUser", "reciptObj", "reportObj", "staffUser", "dbfunc"] \ No newline at end of file +__all__ = ["adminUser", + "bookingObj", + "cinemaObj", + "constants", + "dbfunc", + "filmObj", + "managerUser", + "reportObj", + "screenObj", + "staffUser"] \ No newline at end of file diff --git a/src/__pycache__/__init__.cpython-313.pyc b/src/__pycache__/__init__.cpython-313.pyc index 3ea433e7fed7f8e87d0f5c17f7005fb7d301f861..207ef96e3ae13f5e289cfcdd96a74b5c911dddb4 100644 Binary files a/src/__pycache__/__init__.cpython-313.pyc and b/src/__pycache__/__init__.cpython-313.pyc differ diff --git a/src/__pycache__/bookingObj.cpython-313.pyc b/src/__pycache__/bookingObj.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d3e0d5b6ecf8e13b2712c57e515868e28d0c7d3 Binary files /dev/null and b/src/__pycache__/bookingObj.cpython-313.pyc differ diff --git a/src/__pycache__/cinemaObj.cpython-313.pyc b/src/__pycache__/cinemaObj.cpython-313.pyc index fff11a23e1313031d7094d7791eb0554d8ac907c..c8434df10ff4bc19e6d6aa88b61c8b8fa69c6dac 100644 Binary files a/src/__pycache__/cinemaObj.cpython-313.pyc and b/src/__pycache__/cinemaObj.cpython-313.pyc differ diff --git a/src/__pycache__/constants.cpython-313.pyc b/src/__pycache__/constants.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4ec9b0306337c101c58c8839abb6a14c425239fd Binary files /dev/null and b/src/__pycache__/constants.cpython-313.pyc differ diff --git a/src/__pycache__/filmObj.cpython-313.pyc b/src/__pycache__/filmObj.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de5f515560ff1c6023aab81354fd7a58027117a9 Binary files /dev/null and b/src/__pycache__/filmObj.cpython-313.pyc differ diff --git a/src/__pycache__/screenObj.cpython-313.pyc b/src/__pycache__/screenObj.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..17ae637a2acb498fcd2a97906772c278ccc4b57c Binary files /dev/null and b/src/__pycache__/screenObj.cpython-313.pyc differ diff --git a/src/__pycache__/staffUser.cpython-313.pyc b/src/__pycache__/staffUser.cpython-313.pyc index 40180f169ea7560801a80065e285e3535b188658..3937e79a15d10b7e2ea86d02e02fe74f994cb5bf 100644 Binary files a/src/__pycache__/staffUser.cpython-313.pyc and b/src/__pycache__/staffUser.cpython-313.pyc differ diff --git a/src/cinemaObj.py b/src/cinemaObj.py index 93411ecf32cbf4a4a571a446f5098f3a6d48a403..e0f670c1428b11f74d049bfc1d3a07ab881b4eca 100644 --- a/src/cinemaObj.py +++ b/src/cinemaObj.py @@ -10,7 +10,7 @@ class Cinema(object): """ def __init__(self, id:int=0) -> None: self.cinema_id = id - self.showings = [] + self.listings = [] self.screens = [] def create_screen(self): @@ -22,9 +22,22 @@ class Cinema(object): screen.set_screen_resolution(resolution) screen.set_screen_size(size) - def operation3(self): + def get_listings(self): + # return listing if dict/jason format? pass + def addListing(self, movieID): + # get movie details via movieId + # append list with movie ID and more details to be showen in listing, eg; name, description, picture path. + pass + + def updateListing(self): + # need specify what is to be updated, eg; showing time? + pass + + def removeListing(self): + # do we need this? need to test if can use cinema.listings.remove() + pass diff --git a/src/constants.py b/src/constants.py index 1dba46f34ac2820b355ab62fde1d46a96364026b..ffd8f86a665196230526d9c3a4dac0fc3d1ce7ff 100644 --- a/src/constants.py +++ b/src/constants.py @@ -1,6 +1,10 @@ + +# screeen size in meaters MAX_screen_size:float = 100.0 MIN_screen_size:float = 0.0 +# screen resolution in px MAX_screen_resolution:int = 5000 MIN_screen_resolution:int = 0 +# seating capacity in screen room MAX_screen_capacity:int = 500 MIN_screen_capacity:int = 0 diff --git a/src/filmObj.py b/src/filmObj.py index 2563dff66e4700343871df222fd49acf65c0a143..729950f3069438836b595b3d0fd7dc88c04a8288 100644 --- a/src/filmObj.py +++ b/src/filmObj.py @@ -10,19 +10,14 @@ class Film(object): self.genre = "" self.rating = "" self.description = "" + self.imgPath = "" def __str__(self) -> str: return f"Film(id={self.id}, title={self.title}, genre={self.genre}, rating={self.rating}, description={self.description})" - - def addListing(self): - pass - def updateListing(self): - pass + - def removeListing(self): - pass diff --git a/src/staffUser.py b/src/staffUser.py index 13f19456a67c3c7304aa2f3f50bd2cb8b6e151a8..bc2279491450507e9dfdaddd3c9a00fd3b0027f0 100644 --- a/src/staffUser.py +++ b/src/staffUser.py @@ -4,10 +4,10 @@ import random class StaffUser(object): def __init__(self): - self.userID:int = random.randint(0,10000) + self.userID:int = 0 self.userName:str = self.encrypt("") self.userPass:str = self.encrypt("") - self.permissionLevel = 0 + self.permissionLevel:int = 0 def __str__(self): if self.permissionLevel == 1: @@ -16,7 +16,6 @@ class StaffUser(object): userType = "Manager" else: userType = "BookingStaff" - return f"{userType} user object(userID={self.userID}, userName={self.userName}, userPass={self.userPass})" def login(self): @@ -25,7 +24,10 @@ class StaffUser(object): def logout(self): pass - def veiwFilmListing(self): + def veiwFilmListing(self, cinemaID): + pass + + def createBooking(self): pass def manageBooking():