diff --git a/FrameWidgets.py b/FrameWidgets.py index 6373479..c75eddf 100644 --- a/FrameWidgets.py +++ b/FrameWidgets.py @@ -8,6 +8,7 @@ from pathlib import Path from io import BytesIO from PIL import Image +import requests import json import sys import os @@ -19,9 +20,9 @@ def __init__(self, parent): self.displayingImage = False self.current_zoom = 0.4 # start zoom self.minZoom = 0.1 - self.maxZoom = 3.0 + self.maxZoom = 3.0 self.setAcceptDrops(True) - + def wheelEvent(self, event: QWheelEvent): # Get the wheel delta (positive for scrolling up, negative for scrolling down) angle_delta = event.angleDelta().y() @@ -33,18 +34,18 @@ def wheelEvent(self, event: QWheelEvent): else: # Zoom out zoom = max(self.current_zoom / factor, self.minZoom) - + self.parent.view_slider.setValue(int(zoom * 100)) event.accept() # Mark the event as handled - + def setZoom(self, zoom): if self.displayingImage: self.resetTransform() self.scale(zoom , zoom) #print(zoom) self.current_zoom = zoom - - + + def loadImage(self, pixmap): self.displayingImage = True self.setZoom(self.current_zoom) @@ -93,14 +94,14 @@ def dropEvent(self, event): self.parent.dropEvent(event) class PaintingEditor(QWidget): - + def __init__(self, parent): super().__init__(parent) - + # This is very OOP thus its ok and cool self.parent = parent self.packConrols = self.parent.packConrols - + init_silder_value = 500 self.view_size = int(100 + (init_silder_value / 500) * 300) @@ -113,7 +114,7 @@ def __init__(self, parent): self.lock = True self.updating = False self.backgroundColor = "#000000" - + PaintingEditor_Layout = QVBoxLayout() combine_OptionsViewport = QHBoxLayout() """Options Pane""" @@ -256,7 +257,7 @@ def reset(self): self.view_size = 400 def view_slider_changed(self): - zoom = self.view_slider.value() / 100 + zoom = self.view_slider.value() / 100 self.viewPort.setZoom(zoom) def setButtonEnabled(self, value): diff --git a/PaintingStudio.py b/PaintingStudio.py index 208b5cd..a18fdfe 100644 --- a/PaintingStudio.py +++ b/PaintingStudio.py @@ -1,7 +1,6 @@ import os import json import sys -import requests from pathlib import Path from PyQt5.QtCore import Qt, QUrl, QSize, QTimer, QStringListModel, pyqtSignal from PyQt5.QtGui import QPixmap, QImage, QIcon, QColor, QFont @@ -28,11 +27,11 @@ def __init__(self): # generated stuff self.setWindowTitle("Minecraft Painting Studio") self.setGeometry(100, 100, 1000, 600) - - + + """Menu Bar""" menubar = self.menuBar() - + #File Menu file_menu = menubar.addMenu('File') new_pack_action = QAction('New Pack', self) @@ -44,7 +43,7 @@ def __init__(self): self.save_draft_action = QAction('Save Draft', self) self.save_draft_action.triggered.connect(self.saveToFile) file_menu.addAction(self.save_draft_action) - + # Help Menu help_menu = menubar.addMenu('Help') help_action = QAction('Help', self) @@ -53,7 +52,7 @@ def __init__(self): """ Left Bar """ self.packConrols = PackControls(self) - + """Center Widget""" self.paintingEditor = PaintingEditor(self) @@ -75,7 +74,7 @@ def prog_help(self): def newPack(self): # Create and show the input dialog dialog = InputDialog(self) - + # Check if the dialog was accepted if dialog.exec_() == QDialog.Accepted: title, description, number, icon = dialog.get_data() @@ -154,7 +153,6 @@ def set_theme(app): except: pass current_style = app.style().objectName() - desktop = "" if desktop == "" or current_style == "windowsvista": desktop = "windows" try: