Skip to content
This repository was archived by the owner on May 5, 2024. It is now read-only.

Commit e9beb23

Browse files
committed
first commit for new login!
1 parent 5159887 commit e9beb23

File tree

10 files changed

+181
-86
lines changed

10 files changed

+181
-86
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
# desktopy
1+
# desktopy
2+
# welcome to desktopy!
3+
4+
thanks for looking around my github! if you ever want to work on this project, go to
5+
6+
https://github.dev/charlie-sans/desktopy/tree/v1-login-branch to help and contribute!
1.15 KB
Binary file not shown.
3.04 KB
Binary file not shown.

chat/config.ini.save

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[GUI]
2+
# Window settings
3+
title = PythonOS
4+
geometry = 640x480
5+
6+
# Desktop settings
7+
background_color = grey
8+
9+
# Taskbar settings
10+
taskbar_height = 50
11+
taskbar_color = lightgrey
12+
taskbar_name = taskbar
13+
File "/com.docker.devenvironments.code/chat/desktop.py", line 127, in <module>
14+
root.title(config['GUI']['title'])
15+
File "/usr/lib/python3.9/configparser.py", line 960, in __getitem__
16+
raise KeyError(key)
17+
KeyError: 'GUI' File "/com.docker.devenvironments.code/chat/desktop.py", line 127, in <module>
18+
root.title(config['GUI']['title'])
19+
File "/usr/lib/python3.9/configparser.py", line 960, in __getitem__
20+
raise KeyError(key)
21+
KeyError: 'GUI'

chat/files.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
config_file = os.path.join(os.path.dirname(__file__), 'config.ini')
33
passwords = os.path.join(os.path.dirname(__file__), 'pass.ini')
4+
config_file = os.path.join(os.path.dirname(__file__), 'log.ini')
45
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
56
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
67
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
@@ -98,4 +99,5 @@
9899
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
99100
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
100101
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
101-
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
102+
103+

chat/loginscreen.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# loginscreen.py
2+
import subprocess
13
import tkinter as tk
24
import configparser
35
import os
4-
def main():
5-
print('welcome to pythonOS!')
6-
6+
import argparse
7+
root = tk.Tk()
8+
79
def login():
810
username = username_entry.get()
911
password = password_entry.get()
@@ -17,27 +19,30 @@ def login():
1719
# Check if entered username and password match the ones in the configuration file
1820
if username in config['login'] and config['login'][username] == password:
1921
print("Login successful!")
22+
var = "correct"
23+
result = subprocess.run(["python3", "shell.py"], input=var, capture_output=True, text=True)
24+
root.destroy() # Close the login window
2025
else:
2126
print("Incorrect username or password.")
22-
password_entry.delete(0, tk.END)
23-
24-
# Create main window
25-
root = tk.Tk()
26-
root.title('Login')
2727

2828
# Create login form
2929
username_label = tk.Label(root, text='Username')
3030
username_entry = tk.Entry(root)
3131
password_label = tk.Label(root, text='Password')
3232
password_entry = tk.Entry(root, show='*')
3333
login_button = tk.Button(root, text='Login', command=login)
34-
3534
# Add widgets to the window
3635
username_label.pack()
3736
username_entry.pack()
3837
password_label.pack()
3938
password_entry.pack()
4039
login_button.pack()
4140

42-
# Run the main event loop
43-
root.mainloop()
41+
# Create root window
42+
43+
44+
# Call login() after the root window has been created
45+
login()
46+
47+
# Start the event loop
48+
root.mainloop()

chat/pythonOS.py

Lines changed: 66 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,106 @@
55
import sysconfig
66
import desktop
77
import loginscreen as lsc
8-
from loginscreen import login, login_button, password_label,username_entry,username_label,password_entry
8+
import argparse
99
from desktop import load_files,taskbar,taskbar_color,run_with_panno,run_with_pyle,run_with_python_ide,start_rename,finish_rename,refresh_code,desktop_right_click,root,taskbar_height,taskbar_name,pin_to_taskbar,unpin_from_taskbar,create_file,configparser,show_file_context_menu,file_context_menu,file_path,filepath,find_label,open_file,delete_file,open_html_file,home_directory,keyboard,config,script_path,script_path1,script_dir,is_pinned,panno,show_popup,script_path0,app,argparse,QWebEngineView,math,messagebox,desktop,subprocess,sys
10+
parser = argparse.ArgumentParser(description='Description of your program')
11+
parser.add_argument('-start', help='start the main program!')
12+
args = parser.parse_args()
1013

11-
def main():
14+
def start():
1215
import configparser
1316
config = configparser.ConfigParser()
1417
config.read('config.ini')
15-
login()
1618

19+
def login():
20+
21+
username = username_entry.get()
22+
password = password_entry.get()
23+
24+
# Read passwords from configuration file
25+
config_file = os.path.join(os.path.dirname(__file__), 'pass.ini')
26+
config = configparser.ConfigParser()
27+
config.read(config_file)
28+
print(config.sections()) # Debugging line
29+
print(config.options('login')) # Debugging line
30+
# Check if entered username and password match the ones in the configuration file
31+
if username in config['login'] and config['login'][username] == password:
32+
print("Login successful!")
33+
root.destroy() # Close the login window
34+
35+
else:
36+
print("Incorrect username or password.")
37+
password_entry.delete(0, tk.END)
38+
39+
# Create main window
40+
if args.part == 'A':
41+
root = tk.Tk()
42+
root.title('Login')
43+
44+
# Create login form
45+
username_label = tk.Label(root, text='Username')
46+
username_entry = tk.Entry(root)
47+
password_label = tk.Label(root, text='Password')
48+
password_entry = tk.Entry(root, show='*')
49+
login_button = tk.Button(root, text='Login', command=login)
50+
51+
# Add widgets to the window
52+
username_label.pack()
53+
username_entry.pack()
54+
password_label.pack()
55+
password_entry.pack()
56+
login_button.pack()
57+
58+
# Run the main event loop
59+
root.mainloop()
60+
61+
def loggedin():
62+
login()
63+
64+
def main():
65+
desktop_start_construct()
66+
load_files()
67+
68+
if args.part == 'start':
69+
print('Running start of the code')
70+
# Code for part A goes here
71+
login()
72+
else:
73+
print('Invalid argument')
1774

18-
def loggedin(root,GUI,taskbar_height,taskbar_color,taskbar_name,background_color):
75+
def desktop_start_construct():
1976
#createe main window when logged in
2077
root = tk.Tk()
2178
root.title(config['GUI']['title'])
2279
root.geometry(config['GUI']['geometry'])
23-
80+
2481
# Create taskbar
2582
taskbar_height = int(config['GUI']['taskbar_height'])
2683
taskbar_color = config['GUI']['taskbar_color']
2784
taskbar_name = config['GUI']['taskbar_name']
2885
taskbar = tk.Frame(root, height=taskbar_height, bg=taskbar_color)
2986
taskbar.pack(side=tk.TOP, fill=tk.X)
30-
3187
# Create desktop
3288
desktop = tk.Frame(root, bg=config['GUI']['background_color'])
3389
desktop.pack(expand=True, fill=tk.BOTH)
3490
desktop.bind("<Button-3>", lambda event: file_context_menu.delete(0, tk.END))
35-
3691
# Create file context menu
3792
file_context_menu = tk.Menu(root, tearoff=False)
38-
3993
# Load files onto the desktop
4094
script_dir = os.path.dirname(os.path.abspath(__file__))
4195
load_files()
42-
4396
root.mainloop()
44-
4597
root = tk.Tk()
4698
root.title("PthonOS")
4799
root.geometry("640x480")
48-
49100
taskbar = tk.Frame(root, height=40, bg='lightgrey')
50101
taskbar.pack(side=tk.TOP, fill=tk.X)
51-
52102
desktop = tk.Frame(root, bg='grey')
53103
desktop.pack(expand=True, fill=tk.BOTH)
54104
desktop.bind("<Button-3>", lambda event: file_context_menu.delete(0, tk.END))
55105
file_context_menu = tk.Menu(root, tearoff=False)
56106
script_dir = os.path.dirname(os.path.abspath(__file__))
57-
load_files()
107+
108+
109+
if __name__ == "__main__":
110+
login()

chat/shell.py

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,75 @@
11
import os
2-
import desktop
3-
from desktop import run_with_panno
4-
from desktop import filepath
52
import subprocess
3+
import sys
4+
from loginscreen import login
5+
var = sys.stdin.read()
6+
def open():
7+
print()
8+
9+
def play():
10+
print()
11+
12+
def PythonicOS():
13+
print('welcome to PythonicOS')
14+
15+
def loggedin(var):
16+
17+
if var == 'True':
18+
19+
while True:
20+
# Get user input
21+
user_input = input(os.getcwd() + "> ")
22+
23+
# Split the input into command and arguments
24+
parts = user_input.split()
25+
command = parts[0]
26+
27+
# Execute the command
28+
if command == "cd":
29+
if len(parts) > 1:
30+
os.chdir(parts[1])
31+
else:
32+
print("Please specify a directory to change to.")
33+
elif command == "help":
34+
help()
35+
elif command == "open":
36+
open()
37+
elif command == "play":
38+
play()
39+
40+
elif command == "help":
41+
help()
42+
elif command == "help":
43+
help()
44+
elif command == "help":
45+
help()
46+
elif command == "help":
47+
help()
48+
elif command == "help":
49+
help()
50+
elif command == "help":
51+
help()
52+
elif command == "help":
53+
help()
54+
elif command == "exit":
55+
print("Goodbye!")
56+
break
57+
else:
58+
print("Unknown command. Type 'help' for a list of commands.")
59+
60+
61+
662

763

8-
def display_greetings():
9-
print("Welcome to PythonicOS")
10-
print("Version 1.0\n")
1164

12-
def audioplayer(filepath):
13-
subprocess.Popen(['python', 'addons/audioplayer.py'], cwd=filepath)
14-
def display_help():
15-
print("PythonicOS Help")
65+
66+
def help():
1667
print("-------------")
1768
print("cd <directory>: Changes the current working directory to the specified directory.")
1869
print("help: Displays this help message.")
1970
print("exit: Exits MyShell.\n")
2071
print('mkdir: makes a directory')
2172
print("panno; creates a file")
2273
print("mp: opens a music player")
23-
print("")
24-
print("")
25-
print("")
26-
print("")
27-
print("")
28-
print("")
29-
print("")
30-
print("")
31-
print("")
32-
print("")
33-
print("")
34-
print("")
35-
36-
def start_python_operating_system():
37-
subprocess.Popen(['python', 'PythonOS.py'], cwd=filepath)
38-
39-
40-
def main():
41-
display_greetings()
42-
43-
while True:
44-
# Get user input
45-
user_input = input(os.getcwd() + "> ")
46-
47-
# Split the input into command and arguments
48-
parts = user_input.split()
49-
command = parts[0]
50-
51-
# Execute the command
52-
if command == "cd":
53-
if len(parts) > 1:
54-
os.chdir(parts[1])
55-
else:
56-
print("Please specify a directory to change to.")
57-
elif command == "help":
58-
display_help()
59-
elif command == "panno":
60-
run_with_panno(filepath)
61-
elif command == "mp":
62-
audioplayer(filepath)
63-
elif command == "mkdir":
64-
display_help()
65-
elif command == "PythonOS1":
66-
start_python_operating_system()
67-
elif command == "exit":
68-
print("Goodbye!")
69-
break
70-
else:
71-
print("Unknown command. Type 'help' for a list of commands.")
74+
if __name__ == "__main__":
75+
loggedin(var)

chat/starttest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import subprocess
2+
import os
3+
import sys
4+
def main():
5+
result = subprocess.run([sys.executable, 'loginscreen.py'], capture_output=True, text=True)
6+
print(result.stdout)

docker.dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from python
21
FROM python:3.9-slim
32

43
# Install required packages

0 commit comments

Comments
 (0)