Skip to content
This repository was archived by the owner on Apr 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
120,
]
},
"[py]": {
"editor.tabSize": 4,
"editor.rulers": [
72,
79,
120,
]
},
// Keeping autoformat to false for now to keep minimal changes
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This program compares split images to a capture region of any window (OBS, xspli
- Windows 7 and 10.

### Building
- Read [requirements.txt](/requirements.txt) for information on how to run/build the python code
- Read [requirements.txt](/scripts/requirements.txt) for information on how to run/build the python code

### Opening the program
- Download the [latest version](https://github.com/austinryan/Auto-Split/releases)
Expand Down
26 changes: 0 additions & 26 deletions requirements.txt

This file was deleted.

4 changes: 4 additions & 0 deletions scripts/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

BASEDIR=$(dirname "$0")
pyinstaller -w -F --icon=src/icon.ico "BASEDIR/../src/AutoSplit.py"
4 changes: 4 additions & 0 deletions scripts/install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

BASEDIR=$(dirname "$0")
pip3 install -r "BASEDIR/requirements.txt"
22 changes: 22 additions & 0 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Requirements file for AutoSplit
#
# Python: CPython 3.7+
#
# Usage: ./install.bat
#
# If you're having issues with the libraries, you might want to first run:
# pip3 uninstall -r requirements.txt
#
# Creating AutoSplit.exe with PyInstaller: ./build.bat
#
# Comment this out if you don't want to create AutoSplit.exe:
PyInstaller
#
# Other dependencies:
PyQT5==5.9
opencv-python
Pillow
ImageHash
pywin32==226
keyboard
pyautogui
23 changes: 11 additions & 12 deletions src/AutoSplit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-

from PyQt4 import QtGui, QtCore, QtTest
from PyQt5 import QtCore, QtGui, QtTest, QtWidgets
from menu_bar import about, VERSION, viewHelp
from win32 import win32gui
import sys
Expand All @@ -11,18 +11,17 @@
import time
import ctypes.wintypes
import ctypes
import numpy as np

from hotkeys import send_hotkey
import design
import compare
import capture_windows
import split_parser
import numpy as np



class AutoSplit(QtGui.QMainWindow, design.Ui_MainWindow):
# Importing the functions inside of the class will make them methods of the class
class AutoSplit(QtWidgets.QMainWindow, design.Ui_MainWindow):
from hotkeys import beforeSettingHotkey, afterSettingHotkey, setSplitHotkey, setResetHotkey, setSkipSplitHotkey, setUndoSplitHotkey, setPauseHotkey
from error_messages import (splitImageDirectoryError, splitImageDirectoryNotFoundError, imageTypeError, regionError, regionSizeError,
splitHotkeyError, customThresholdError, customPauseError, alphaChannelError, alignRegionImageTypeError, alignmentNotMatchedError,
Expand Down Expand Up @@ -182,7 +181,7 @@ def run(self):
def browse(self):
# User selects the file with the split images in it.
self.split_image_directory = str(
QtGui.QFileDialog.getExistingDirectory(self, "Select Split Image Directory")) + '\\'
QtWidgets.QFileDialog.getExistingDirectory(self, "Select Split Image Directory")) + '\\'

# If the user doesn't select a folder, it defaults to \. Set it back to whats in the LineEdit, and return
if self.split_image_directory == '\\':
Expand Down Expand Up @@ -558,7 +557,7 @@ def autoSplitter(self):
if self.waiting_for_split_delay == True:
time_millis = int(round(time.time() * 1000))
if time_millis < self.split_time:
QtGui.QApplication.processEvents()
QtWidgets.QApplication.processEvents()
continue

self.updateSplitImage()
Expand Down Expand Up @@ -659,7 +658,7 @@ def autoSplitter(self):
# limit the number of time the comparison runs to reduce cpu usage
fps_limit = self.fpslimitSpinBox.value()
time.sleep((1 / fps_limit) - (time.time() - start) % (1 / fps_limit))
QtGui.QApplication.processEvents()
QtWidgets.QApplication.processEvents()

# comes here when threshold gets met

Expand Down Expand Up @@ -764,7 +763,7 @@ def autoSplitter(self):
else:
self.undosplitButton.setEnabled(True)

QtGui.QApplication.processEvents()
QtWidgets.QApplication.processEvents()

# I have a pause loop here so that it can check if the user presses skip split, undo split, or reset here.
# Also updates the current split image text, counting down the time until the next split image
Expand Down Expand Up @@ -822,7 +821,7 @@ def guiChangesOnStart(self):
self.setundosplithotkeyButton.setEnabled(False)
self.setpausehotkeyButton.setEnabled(False)

QtGui.QApplication.processEvents()
QtWidgets.QApplication.processEvents()

def guiChangesOnReset(self):
self.startautosplitterButton.setText('Start Auto Splitter')
Expand All @@ -847,7 +846,7 @@ def guiChangesOnReset(self):
self.setundosplithotkeyButton.setEnabled(True)
self.setpausehotkeyButton.setEnabled(True)

QtGui.QApplication.processEvents()
QtWidgets.QApplication.processEvents()

def compareImage(self, image, mask, capture):
if mask is None:
Expand Down Expand Up @@ -1019,7 +1018,7 @@ def exit():

if self.haveSettingsChanged():
# give a different warning if there was never a settings file that was loaded successfully, and save as instead of save.
msgBox = QtGui.QMessageBox
msgBox = QtWidgets.QMessageBox
settings_file_name = "Untitled" \
if self.last_successfully_loaded_settings_file_path is None \
else os.path.basename(self.last_successfully_loaded_settings_file_path)
Expand All @@ -1040,7 +1039,7 @@ def exit():


def main():
app = QtGui.QApplication(sys.argv)
app = QtWidgets.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon('icon.ico'))
w = AutoSplit()
w.setWindowIcon(QtGui.QIcon('icon.ico'))
Expand Down
28 changes: 14 additions & 14 deletions src/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Form implementation generated from reading ui file 'about.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
# Created by: PyQt5 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets

try:
_fromUtf8 = QtCore.QString.fromUtf8
Expand All @@ -15,12 +15,12 @@ def _fromUtf8(s):
return s

try:
_encoding = QtGui.QApplication.UnicodeUTF8
_encoding = QtWidgets.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
return QtWidgets.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
return QtWidgets.QApplication.translate(context, text, disambig)

class Ui_aboutAutoSplitWidget(object):
def setupUi(self, aboutAutoSplitWidget):
Expand All @@ -31,28 +31,28 @@ def setupUi(self, aboutAutoSplitWidget):
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/resources/icon.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
aboutAutoSplitWidget.setWindowIcon(icon)
self.okButton = QtGui.QPushButton(aboutAutoSplitWidget)
self.okButton = QtWidgets.QPushButton(aboutAutoSplitWidget)
self.okButton.setGeometry(QtCore.QRect(190, 220, 71, 21))
self.okButton.setObjectName(_fromUtf8("okButton"))
self.createdbyLabel = QtGui.QLabel(aboutAutoSplitWidget)
self.createdbyLabel = QtWidgets.QLabel(aboutAutoSplitWidget)
self.createdbyLabel.setGeometry(QtCore.QRect(10, 44, 151, 16))
self.createdbyLabel.setObjectName(_fromUtf8("createdbyLabel"))
self.versionLabel = QtGui.QLabel(aboutAutoSplitWidget)
self.versionLabel = QtWidgets.QLabel(aboutAutoSplitWidget)
self.versionLabel.setGeometry(QtCore.QRect(10, 21, 71, 16))
self.versionLabel.setObjectName(_fromUtf8("versionLabel"))
self.donatetextLabel = QtGui.QLabel(aboutAutoSplitWidget)
self.donatetextLabel = QtWidgets.QLabel(aboutAutoSplitWidget)
self.donatetextLabel.setGeometry(QtCore.QRect(46, 95, 191, 41))
self.donatetextLabel.setObjectName(_fromUtf8("donatetextLabel"))
self.donatebuttonLabel = QtGui.QLabel(aboutAutoSplitWidget)
self.donatebuttonLabel = QtWidgets.QLabel(aboutAutoSplitWidget)
self.donatebuttonLabel.setGeometry(QtCore.QRect(52, 127, 171, 91))
self.donatebuttonLabel.setAlignment(QtCore.Qt.AlignCenter)
self.donatebuttonLabel.setObjectName(_fromUtf8("donatebuttonLabel"))
self.iconLabel = QtGui.QLabel(aboutAutoSplitWidget)
self.iconLabel = QtWidgets.QLabel(aboutAutoSplitWidget)
self.iconLabel.setGeometry(QtCore.QRect(190, 17, 62, 71))
self.iconLabel.setObjectName(_fromUtf8("iconLabel"))

self.retranslateUi(aboutAutoSplitWidget)
QtCore.QObject.connect(self.okButton, QtCore.SIGNAL(_fromUtf8("clicked()")), aboutAutoSplitWidget.close)
self.okButton.clicked.connect(aboutAutoSplitWidget.close)
QtCore.QMetaObject.connectSlotsByName(aboutAutoSplitWidget)

def retranslateUi(self, aboutAutoSplitWidget):
Expand All @@ -69,8 +69,8 @@ def retranslateUi(self, aboutAutoSplitWidget):

if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
aboutAutoSplitWidget = QtGui.QWidget()
app = QtWidgets.QApplication(sys.argv)
aboutAutoSplitWidget = QtWidgets.QWidget()
ui = Ui_aboutAutoSplitWidget()
ui.setupUi(aboutAutoSplitWidget)
aboutAutoSplitWidget.show()
Expand Down
Loading