Skip to content

Commit

Permalink
🔀 Merge Add-move-to-globale-view (#84)
Browse files Browse the repository at this point in the history
🎉 Add move to global view when spacebar is pressed
  • Loading branch information
MathisFederico authored Dec 3, 2021
2 parents 7456c4b + c823ed2 commit 0fde389
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 141 deletions.
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ valid-metaclass-classmethod-first-arg=cls
max-args=10

# Maximum number of attributes for a class (see R0902).
max-attributes=20
max-attributes=30

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5
Expand All @@ -542,7 +542,7 @@ max-locals=20
max-parents=7

# Maximum number of public methods for a class (see R0904).
max-public-methods=20
max-public-methods=30

# Maximum number of return / yield for function / method body.
max-returns=6
Expand Down
10 changes: 5 additions & 5 deletions opencodeblocks/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import sys
import asyncio

if os.name == "nt": # If on windows
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

from qtpy.QtWidgets import QApplication
from opencodeblocks.graphics.window import OCBWindow

if os.name == "nt": # If on windows
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))

if __name__ == '__main__':
if __name__ == "__main__":
app = QApplication(sys.argv)
app.setStyle('Fusion')
app.setStyle("Fusion")
wnd = OCBWindow()
if len(sys.argv) > 1:
wnd.createNewMdiChild(sys.argv[1])
Expand Down
8 changes: 3 additions & 5 deletions opencodeblocks/blocks/codeblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

""" Module for the base OCB Code Block. """

from PyQt5.QtCore import QByteArray
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QPushButton, QTextEdit

from ansi2html import Ansi2HTMLConverter
Expand All @@ -29,9 +27,9 @@ class OCBCodeBlock(OCBBlock):
"""

def __init__(self, **kwargs):
"""
Create a new OCBCodeBlock.
Initialize all the child widgets specific to this block type
"""
Create a new OCBCodeBlock.
Initialize all the child widgets specific to this block type
"""
self.source_editor = PythonEditor(self)

Expand Down
12 changes: 6 additions & 6 deletions opencodeblocks/blocks/widgets/blocksplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@


class OCBSplitterHandle(QSplitterHandle):
""" A handle for splitters with undoable events """
"""A handle for splitters with undoable events"""

def mouseReleaseEvent(self, evt: QMouseEvent):
""" When releasing the handle, save the state to history """
"""When releasing the handle, save the state to history"""
scene = self.parent().block.scene()
if scene is not None:
scene.history.checkpoint("Resize block", set_modified=True)
return super().mouseReleaseEvent(evt)


class OCBSplitter(QSplitter):
""" A spliter with undoable events """
"""A spliter with undoable events"""

def __init__(self, block: QWidget, orientation: int, parent: QWidget):
""" Create a new OCBSplitter """
"""Create a new OCBSplitter"""
super().__init__(orientation, parent)
self.block = block

def createHandle(self):
""" Return the middle handle of the splitter """
return OCBSplitterHandle(self.orientation(), self)
"""Return the middle handle of the splitter"""
return OCBSplitterHandle(self.orientation(), self)
Loading

0 comments on commit 0fde389

Please sign in to comment.