Skip to content

Commit

Permalink
🎉 Work on implementing the container. A circular dependency needs to …
Browse files Browse the repository at this point in the history
…be removed.
  • Loading branch information
vanyle committed Dec 11, 2021
1 parent 2e4b402 commit 58df0ce
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
16 changes: 16 additions & 0 deletions blocks/container.ocbb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"title": "Container",
"block_type": "OCBContainerBlock",
"source": "",
"splitter_pos": [88,41],
"width": 618,
"height": 184,
"metadata": {
"title_metadata": {
"color": "white",
"font": "Ubuntu",
"size": 10,
"padding": 4.0
}
}
}
1 change: 1 addition & 0 deletions opencodeblocks/blocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
from opencodeblocks.blocks.codeblock import OCBCodeBlock
from opencodeblocks.blocks.markdownblock import OCBMarkdownBlock
from opencodeblocks.blocks.drawingblock import OCBDrawingBlock
from opencodeblocks.blocks.containerblock import OCBContainerBlock
13 changes: 12 additions & 1 deletion opencodeblocks/blocks/containerblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
Exports OCBContainerBlock.
"""

from PyQt5.QtWidgets import QVBoxLayout
from opencodeblocks.blocks.block import OCBBlock
from opencodeblocks.graphics.view import OCBView
from opencodeblocks.graphics.widget import OCBWidget
from opencodeblocks.scene.scene import OCBScene


class OCBContainerBlock(OCBBlock):
Expand All @@ -13,4 +17,11 @@ class OCBContainerBlock(OCBBlock):
def __init__(self, **kwargs):
super().__init__(**kwargs)

# WIP
self.layout = QVBoxLayout(self.root)

self.scene = OCBScene()
self.scene.addHasBeenModifiedListener(self.updateTitle)
self.view = OCBView(self.scene)
self.layout.addWidget(self.view)

self.holder.setWidget(self.root)
2 changes: 1 addition & 1 deletion opencodeblocks/graphics/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from opencodeblocks.graphics.socket import OCBSocket
from opencodeblocks.graphics.edge import OCBEdge
from opencodeblocks.blocks.block import OCBBlock
from opencodeblocks.blocks import OCBCodeBlock
from opencodeblocks.blocks.codeblock import OCBCodeBlock

EPS: float = 1e-10 # To check if blocks are of size 0

Expand Down
3 changes: 1 addition & 2 deletions opencodeblocks/scene/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from PyQt5.QtGui import QColor, QPainter, QPen
from PyQt5.QtWidgets import QGraphicsScene

from opencodeblocks import blocks

from opencodeblocks.core.serializable import Serializable
from opencodeblocks.blocks.block import OCBBlock
from opencodeblocks.graphics.edge import OCBEdge
Expand Down Expand Up @@ -218,6 +216,7 @@ def create_block(self, data: OrderedDict, hashmap: dict = None,
""" Create a new block from an OrderedDict """

block = None
blocks = __import__("opencodeblocks.blocks")

block_constructor = None
block_files = blocks.__dict__
Expand Down

0 comments on commit 58df0ce

Please sign in to comment.