Skip to content

Commit

Permalink
resolution adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
darkoverlordofdata committed May 1, 2023
1 parent 085203e commit 8f4e80d
Show file tree
Hide file tree
Showing 9 changed files with 516 additions and 74 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
obj
*.app
*.app
.cache
84 changes: 50 additions & 34 deletions Resources/catlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def __init__(self, dbus, valid, sysname, pin, fontFamily, tz, width, height):
# Create widget
super().__init__()

print(f'Resolution width: {width}, height: {height} ')
if height >=1280:
self.factor = 2
else:
self.factor = 1.5
self.lockedFlag = True
self.counter = 0
self.eol = 0
Expand All @@ -93,11 +98,12 @@ def __init__(self, dbus, valid, sysname, pin, fontFamily, tz, width, height):
self.count = 0
self.pin = pin
self.fontFamily = fontFamily
print("font = "+self.fontFamily)
self.tz = tz
self.full_name = pwd.getpwuid(os.getuid()).pw_gecos
self.full_name = self.full_name.replace(",,,", "")
if self.full_name == "":
self.full_name = pwd.getpwuid(os.getuid()).pw_name
self.fullName = pwd.getpwuid(os.getuid()).pw_gecos
self.fullName = self.fullName.replace(",,,", "")
if self.fullName == "":
self.fullName = pwd.getpwuid(os.getuid()).pw_name


with open(LOCAL + '/themes/wallpaper.description') as f:
Expand All @@ -106,8 +112,8 @@ def __init__(self, dbus, valid, sysname, pin, fontFamily, tz, width, height):
self.info = tmp.split("(©")[0]
self.copyright = "(©" + tmp.split("(©")[1] + ")"

self.authorize = QPixmap(LOCAL + '/themes/wallpaper.authorize.jpg')
self.locked = QPixmap(LOCAL + '/themes/wallpaper.locked.jpg')
self.authorize = QPixmap(LOCAL + '/themes/wallpaper.authorize.jpg').scaled(width, height)
self.locked = QPixmap(LOCAL + '/themes/wallpaper.locked.jpg').scaled(width, height)

self.setGeometry(self.left, self.top, self.width, self.height)

Expand All @@ -116,17 +122,15 @@ def __init__(self, dbus, valid, sysname, pin, fontFamily, tz, width, height):
else:
self.avatar = QPixmap(LOCAL + '/avatar.png')

# fnt_60 = QFont(self.fontFamily, 60, QFont.Normal)
fnt_120 = QFont(self.fontFamily, 120, QFont.Normal)
fnt_64 = QFont(self.fontFamily, 64, QFont.Normal)
fnt_32 = QFont(self.fontFamily, 32, QFont.Normal)
fnt_24 = QFont(self.fontFamily, 24, QFont.Normal)
fnt_18 = QFont(self.fontFamily, 18, QFont.Normal)

fnt_30 = QFont(self.fontFamily, 30, QFont.Normal)
fnt_20 = QFont(self.fontFamily, 20, QFont.Normal)
fnt_12 = QFont(self.fontFamily, 12, QFont.Normal)
fnt_10 = QFont(self.fontFamily, 10, QFont.Normal)
clockFont = QFont(self.fontFamily, int(60*self.factor), QFont.Normal)
calendarFont = QFont(self.fontFamily, int(32*self.factor), QFont.Normal)
titleFont = QFont(self.fontFamily, int(16*self.factor), QFont.Normal)
infoFont = QFont(self.fontFamily, int(12*self.factor), QFont.Normal)
copyrightFont = QFont(self.fontFamily, 18, QFont.Normal)

textFont = QFont(self.fontFamily, 30, QFont.Normal)
nameFont = QFont(self.fontFamily, 20, QFont.Normal)
instructionFont = QFont(self.fontFamily, 10, QFont.Normal)

self.background = QLabel(self)
self.background.setPixmap(self.locked)
Expand All @@ -137,15 +141,15 @@ def __init__(self, dbus, valid, sysname, pin, fontFamily, tz, width, height):
self.userpic.setVisible(False)

self.username = QLabel(self)
self.username.setFont(fnt_20)
self.username.setText(self.full_name)
self.username.move(int((self.width*.5)-(len(self.full_name)*.5)-(len(self.full_name)*6)), int(self.height*.666-80))
self.username.setFont(nameFont)
self.username.setText(self.fullName)
self.username.move(int((self.width*.5)-(len(self.fullName)*.5)-(len(self.fullName)*6)), int(self.height*.666-80))
self.username.setStyleSheet("color: white")
self.username.setVisible(False)

self.textbox = QLineEdit(self)
self.textbox.setEchoMode(QLineEdit.Password)
self.textbox.setFont(fnt_30)
self.textbox.setFont(textFont)

x = int((self.width*.5)-125)
y = int(self.height*.666)
Expand All @@ -154,42 +158,54 @@ def __init__(self, dbus, valid, sysname, pin, fontFamily, tz, width, height):
self.textbox.resize(280, 50)
self.textbox.setVisible(False)

radius = 10
self.textbox.setStyleSheet(
"""
color:rgba(54, 69, 79, 255);
background:rgba(250, 244, 211, 127);
border-top-left-radius:{0}px;
border-bottom-left-radius:{0}px;
border-top-right-radius:{0}px;
border-bottom-right-radius:{0}px;
""".format(radius)
)

self.instructions = QLabel(self)
self.instructions.setFont(fnt_10)
self.instructions.setFont(instructionFont)
self.instructions.setText("Enter PIN")
self.instructions.move(int(self.width*.5)-30, int(self.height*.666+60))
self.instructions.setVisible(False)
self.instructions.setStyleSheet("color: white")
self.instructions.setStyleSheet("color: white;" )

self.titlebox = QLabel(self)
self.titlebox.setFont(fnt_32)
self.titlebox.setFont(titleFont)
self.titlebox.setText(self.title)
self.titlebox.move(60, 40)
self.titlebox.setStyleSheet("color: white")
self.titlebox.setStyleSheet("color: white;")
self.titlebox.setFocusPolicy(Qt.ClickFocus | Qt.TabFocus | Qt.NoFocus)


self.infobox = QLabel(self)
self.infobox.setFont(fnt_24)
self.infobox.setFont(infoFont)
self.infobox.setText(self.info)
self.infobox.move(60, 95)
self.infobox.setStyleSheet("color: white")
self.infobox.setStyleSheet("color: white;")

self.copybox = QLabel(self)
self.copybox.setFont(fnt_18)
self.copybox.setFont(copyrightFont)
self.copybox.setText(self.copyright[:-1])
self.copybox.move(60, 140)
self.copybox.setStyleSheet("color: white")
self.copybox.setStyleSheet("color: white;")

self.clock = QLabel(self)
self.clock.setFont(fnt_120)
self.clock.setFont(clockFont)
# self.clock.move(60, int(self.height * 0.70))
self.clock.move(60, int(self.height * 0.65))
self.clock.setStyleSheet("color: white")

self.clock.setStyleSheet("color: white;")
self.calendar = QLabel(self)
self.calendar.setFont(fnt_64)
self.calendar.setFont(calendarFont)
self.calendar.move(60, int(self.height * 0.85))
self.calendar.setStyleSheet("color: white")
self.calendar.setStyleSheet("color: white;")

self.showTime()
self.clock.show()
Expand Down
Binary file modified Resources/themes/wallpaper.authorize.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/themes/wallpaper.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/themes/wallpaper.locked.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Source/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ - (instancetype) init
_defaultPin = @"420420";
_defaultAt = @"01:01";
_defaultFont = @"SanFranciscoDisplay-Medium";
// _defaultFont = @"NimbusSans-Regular";
return self;

}
Expand Down
1 change: 1 addition & 0 deletions Source/Interactive/ImagePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#import <Cocoa/Cocoa.h>
#import "ImageWindow.h"
#import "../Extensions/NSImage+SaveAs.h"
#import "../Extensions/NSImage+ResizeImage.h"

@class ImageWindow;

Expand Down
Loading

0 comments on commit 8f4e80d

Please sign in to comment.