summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/python/main.py6
-rw-r--r--src/main/python/utils/canvas.py6
-rw-r--r--src/main/python/utils/fileWindow.py12
-rw-r--r--src/main/python/utils/graphics.py16
-rw-r--r--src/main/python/utils/tabs.py12
-rw-r--r--src/main/python/utils/toolbar.py6
6 files changed, 29 insertions, 29 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py
index 7a73c7a..9683f00 100644
--- a/src/main/python/main.py
+++ b/src/main/python/main.py
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (QComboBox, QFileDialog, QFormLayout, QVBoxLayout,
QPushButton, QWidget, QMdiArea, QSplitter, QGraphicsItem)
from utils.canvas import canvas
-from utils.fileWindow import fileWindow
+from utils.fileWindow import FileWindow
from utils.data import ppiList, sheetDimensionList
from utils import dialogs
from utils.toolbar import toolbar
@@ -92,7 +92,7 @@ class appWindow(QMainWindow):
def newProject(self):
#call to create a new file inside mdi area
- project = fileWindow(self.mdi)
+ project = FileWindow(self.mdi)
project.setObjectName("New Project")
self.mdi.addSubWindow(project)
if not project.tabList: # important when unpickling a file instead
@@ -110,7 +110,7 @@ class appWindow(QMainWindow):
for files in name[0]:
with open(files,'r') as file:
projectData = load(file)
- project = fileWindow(self.mdi)
+ project = FileWindow(self.mdi)
self.mdi.addSubWindow(project)
project.__setstate__(projectData)
project.resizeHandler()
diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py
index b60f11c..8608f7b 100644
--- a/src/main/python/utils/canvas.py
+++ b/src/main/python/utils/canvas.py
@@ -4,14 +4,14 @@ from PyQt5.QtWidgets import (QFileDialog, QApplication, QHBoxLayout, QMenu,
QTabWidget, QWidget, QSpacerItem, QStyle, QGraphicsProxyWidget)
from . import dialogs
-from .graphics import customView, customScene
+from .graphics import CustomView, CustomScene
from .data import paperSizes, ppiList, sheetDimensionList
from .app import memMap
from .streamTable import streamTable, moveRect
import shapes
-class canvas(customView):
+class canvas(CustomView):
"""
Defines the work area for a single sheet. Contains a QGraphicScene along with necessary properties
for context menu and dialogs.
@@ -30,7 +30,7 @@ class canvas(customView):
# when we will draw items on this, this might be changed if QGraphicScene is subclassed.
#set layout and background color
- self.painter = customScene()
+ self.painter = CustomScene()
self.painter.labelAdded.connect(self.updateStreamTable)
self.painter.setBackgroundBrush(QBrush(Qt.white)) #set white background
self.setScene(self.painter)
diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py
index e85d513..b2f5304 100644
--- a/src/main/python/utils/fileWindow.py
+++ b/src/main/python/utils/fileWindow.py
@@ -5,14 +5,14 @@ from PyQt5.QtWidgets import (QFileDialog, QHBoxLayout,
QSplitter, QWidget, QStyle, QSizePolicy)
from os import path
from . import dialogs
-from .graphics import customView
+from .graphics import CustomView
from .canvas import canvas
-from .tabs import customTabWidget
+from .tabs import CustomTabWidget
from .undo import resizeCommand
from .app import dump, loads, JSON_Typer, version
-class fileWindow(QMdiSubWindow):
+class FileWindow(QMdiSubWindow):
"""
This defines a single file, inside the application, consisting of multiple tabs that contain
canvases. Pre-Defined so that a file can be instantly created without defining the structure again.
@@ -21,14 +21,14 @@ class fileWindow(QMdiSubWindow):
tabChangeEvent = pyqtSignal()
def __init__(self, parent = None, title = 'New Project', size = 'A0', ppi = '72'):
- super(fileWindow, self).__init__(parent)
+ super(FileWindow, self).__init__(parent)
self._sideViewTab = None
self.index = None
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
#Uses a custom QTabWidget that houses a custom new Tab Button, used to house the seperate
# diagrams inside a file
- self.tabber = customTabWidget(self)
+ self.tabber = CustomTabWidget(self)
self.tabber.setObjectName(title) #store title as object name for pickling
self.tabber.tabCloseRequested.connect(self.closeTab) # Show save alert on tab close
self.tabber.currentChanged.connect(self.changeTab) # placeholder just to detect tab change
@@ -67,7 +67,7 @@ class fileWindow(QMdiSubWindow):
def createSideViewArea(self):
#creates the side view widgets and sets them to invisible
# self.splitter = QSplitter(Qt.Vertical ,self)
- self.sideView = customView(parent = self)
+ self.sideView = CustomView(parent = self)
self.sideView.setInteractive(False)
self.sideViewCloseButton = QPushButton('×', self.sideView)
self.sideViewCloseButton.setObjectName("sideViewCloseButton")
diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py
index a9820a2..05ffc46 100644
--- a/src/main/python/utils/graphics.py
+++ b/src/main/python/utils/graphics.py
@@ -7,16 +7,16 @@ from .dialogs import showUndoDialog
import shapes
-class customView(QGraphicsView):
+class CustomView(QGraphicsView):
"""
Defines custom QGraphicsView with zoom features and drag-drop accept event, overriding wheel event
"""
def __init__(self, scene = None, parent=None):
if scene is not None: #overloaded constructor
- super(customView, self).__init__(scene, parent)
+ super(CustomView, self).__init__(scene, parent)
else:
- super(customView, self).__init__(parent)
+ super(CustomView, self).__init__(parent)
self._zoom = 1
self.setDragMode(True) #sets pannable using mouse
self.setAcceptDrops(True) #sets ability to accept drops
@@ -67,7 +67,7 @@ class customView(QGraphicsView):
self.zoom += QWheelEvent.angleDelta().y()
QWheelEvent.accept() # accept event so that scrolling doesnt happen simultaneously
else:
- return super(customView, self).wheelEvent(QWheelEvent) # scroll if ctrl not pressed
+ return super(CustomView, self).wheelEvent(QWheelEvent) # scroll if ctrl not pressed
@property
def zoom(self):
@@ -81,14 +81,14 @@ class customView(QGraphicsView):
self._zoom = value
self.scale(self.zoom / temp, self.zoom / temp)
-class customScene(QGraphicsScene):
+class CustomScene(QGraphicsScene):
"""
Extends QGraphicsScene with undo-redo functionality
"""
labelAdded = pyqtSignal(shapes.QGraphicsItem)
def __init__(self, *args, parent=None):
- super(customScene, self).__init__(*args, parent=parent)
+ super(CustomScene, self).__init__(*args, parent=parent)
self.undoStack = QUndoStack(self) #Used to store undo-redo moves
self.createActions() #creates necessary actions that need to be called for undo-redo
@@ -133,7 +133,7 @@ class customScene(QGraphicsScene):
if self.movingItem and event.button() == Qt.LeftButton:
self.oldPos = self.movingItem.pos() #if left click is held, then store old pos
self.clearSelection() #clears selected items
- return super(customScene, self).mousePressEvent(event)
+ return super(CustomScene, self).mousePressEvent(event)
def mouseReleaseEvent(self, event):
# overloaded mouse release event to check if an item was moved
@@ -142,4 +142,4 @@ class customScene(QGraphicsScene):
#if item pos had changed, when mouse was realeased, emit itemMoved signal
self.itemMoved(self.movingItem, self.oldPos)
self.movingItem = None #clear movingitem reference
- return super(customScene, self).mouseReleaseEvent(event)
+ return super(CustomScene, self).mouseReleaseEvent(event)
diff --git a/src/main/python/utils/tabs.py b/src/main/python/utils/tabs.py
index 1186191..cedb298 100644
--- a/src/main/python/utils/tabs.py
+++ b/src/main/python/utils/tabs.py
@@ -1,7 +1,7 @@
from PyQt5.QtWidgets import QTabBar, QPushButton, QTabWidget, QInputDialog
from PyQt5.QtCore import pyqtSignal, QSize, Qt
-class tabBarPlus(QTabBar):
+class TabBarPlus(QTabBar):
"""
Just implemented to overload resize and layout change to emit a signal
"""
@@ -26,17 +26,17 @@ class tabBarPlus(QTabBar):
self.nameChanged.emit(index, newName)
-class customTabWidget(QTabWidget):
+class CustomTabWidget(QTabWidget):
"""
QTabWidget with a new tab button, also catches layoutChange signal by
- the tabBarPlus to dynamically move the button to the correct location
+ the TabBarPlus to dynamically move the button to the correct location
"""
plusClicked = pyqtSignal()
def __init__(self, parent=None):
- super(customTabWidget, self).__init__(parent)
+ super(CustomTabWidget, self).__init__(parent)
- self.tab = tabBarPlus()
- self.setTabBar(self.tab) #set tabBar to our custom tabBarPlus
+ self.tab = TabBarPlus()
+ self.setTabBar(self.tab) #set tabBar to our custom TabBarPlus
self.plusButton = QPushButton('+', self) #create the new tab button
#style the new tab button
diff --git a/src/main/python/utils/toolbar.py b/src/main/python/utils/toolbar.py
index a175aff..3f6338b 100644
--- a/src/main/python/utils/toolbar.py
+++ b/src/main/python/utils/toolbar.py
@@ -107,7 +107,7 @@ class toolbar(QDockWidget):
#helper functions to create required buttons
for itemClass in itemClasses:
self.toolbarButtonDict[itemClass] = {}
- label = sectionLabel(itemClass)
+ label = SectionLabel(itemClass)
self.toolbarLabelDict[itemClass] = label
for item in toolbarItems[itemClass].keys():
obj = toolbarItems[itemClass][item]
@@ -165,7 +165,7 @@ class toolbarButton(QToolButton):
#defines button size
return QSize(55, 55)
-class sectionLabel(QLabel):
+class SectionLabel(QLabel):
def __init__(self, *args):
- super(sectionLabel, self).__init__(*args) \ No newline at end of file
+ super(SectionLabel, self).__init__(*args) \ No newline at end of file