Skip to content

Commit

Permalink
Merge pull request #226 from Glas42/main
Browse files Browse the repository at this point in the history
The app now supports non main monitors.
  • Loading branch information
Glas42 authored Feb 24, 2024
2 parents 581eb5e + 1c569db commit 5b3a074
Show file tree
Hide file tree
Showing 9 changed files with 1,557 additions and 1,141 deletions.
3 changes: 3 additions & 0 deletions blog/V1.10.Minor.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ title: Version 1.10 > Minor
This changelog will contain all changes from 1.10.0 onwards before the next major version.
!!!

==- Version 1.10.29
The app now supports non main monitors.
[!badge variant="dark" text="Glas42"] [!badge variant="ghost" text="Setup Scripts"]
==- Version 1.10.28
Fix favorites bar not working correctly. (ony the last favorite would be opened, regardless of which one was clicked)
[!badge variant="dark" text="Tumppi066"] [!badge variant="ghost" text="Main UI"]
Expand Down
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix favorites only opening the last favorite.
The app now supports non main monitors.
13 changes: 8 additions & 5 deletions plugins/MSSScreenCapture/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
def CreateCamera():
global width
global height
global display
global monitor
global monitor_full

width = settings.GetSettings("bettercam", "width")
if width == None:
Expand All @@ -53,11 +53,16 @@ def CreateCamera():
if y == None:
settings.CreateSettings("bettercam", "y", 0)
y = 0

display = settings.GetSettings("bettercam", "display")
if display == None:
settings.CreateSettings("bettercam", "display", 0)
display = 0
display += 1

left, top = x, y
right, bottom = left + width, top + height
monitor = (left,top,right,bottom)
monitor_full = (0,0,pyautogui.size().width,pyautogui.size().height)

CreateCamera()

Expand All @@ -73,9 +78,7 @@ def onDisable():
def plugin(data):
try:
# Capture full screen once
frame = sct.grab(monitor_full)
# Make the frame usable for opencv
frame = cv2.cvtColor(np.array(frame), cv2.COLOR_RGBA2RGB)
frame = cv2.cvtColor(np.array(sct.grab(sct.monitors[(display + 1)])), cv2.COLOR_BGRA2BGR)
# Save the full frame
data["frameFull"] = frame
# Crop the frame to the selected area and save
Expand Down
1,018 changes: 576 additions & 442 deletions plugins/NavigationDetection/automatic_setup.py

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions plugins/NavigationDetection/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
"""
This is an example of a plugin (type="dynamic"), they will be updated during the stated point in the mainloop.
If you need to make a panel that is only updated when it's open then check the Panel example!
"""


from plugins.plugin import PluginInformation
PluginInfo = PluginInformation(
name="NavigationDetection",
Expand Down Expand Up @@ -33,7 +27,6 @@
import plugins.DefaultSteering.main as DefaultSteering
import numpy as np
import subprocess
import pyautogui
import ctypes
import time
import cv2
Expand Down Expand Up @@ -288,7 +281,7 @@ def plugin(data):
valid_frame = False
return data

if (0 <= map_topleft[0] < arrow_topleft[0] < arrow_bottomright[0] < map_bottomright[0] < pyautogui.size().width) and (0 <= map_topleft[1] < arrow_topleft[1] < arrow_bottomright[1] < map_bottomright[1] < pyautogui.size().height):
if (0 <= map_topleft[0] < arrow_topleft[0] < arrow_bottomright[0] < map_bottomright[0] < data["frameFull"].shape[1]) and (0 <= map_topleft[1] < arrow_topleft[1] < arrow_bottomright[1] < map_bottomright[1] < data["frameFull"].shape[0]):
valid_setup = True
else:
valid_setup = False
Expand Down
Loading

0 comments on commit 5b3a074

Please sign in to comment.