Skip to content

Commit

Permalink
Basic events mindmap (#664)
Browse files Browse the repository at this point in the history
* Empty graphics view and scene

* Remove coveralls

* Character node item

* Basic connector

* Start eventitem

* Event sockets

* Display sockets on linking hover event

* Edit event text

* bg color

* paint socket

* remove helpers

* connect sockets

* Rearrange connectors

* zoombar

* Add new event

* alt hover socket

* Fix tests
  • Loading branch information
zkovari authored Aug 17, 2023
1 parent ebbbd7c commit df9dd73
Show file tree
Hide file tree
Showing 7 changed files with 673 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ jobs:
DISPLAY: ':99.0'
run: |
./test.sh
pip install coveralls
coveralls --service=github
core-windows-test:
runs-on: windows-2019
Expand Down
19 changes: 16 additions & 3 deletions src/main/python/plotlyst/view/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from fbs_runtime import platform
from overrides import overrides
from qtanim import fade_out
from qthandy import hbox, vbox, margins, gc
from qthandy import hbox, vbox, margins, gc, transparent

from src.main.python.plotlyst.env import app_env

Expand Down Expand Up @@ -372,7 +372,8 @@ def insert_after(parent: QWidget, widget: QWidget, reference: QWidget):


def tool_btn(icon: QIcon, tooltip: str = '', checkable: bool = False, base: bool = False,
icon_resize: bool = True) -> QToolButton:
icon_resize: bool = True, transparent_: bool = False, properties: List[str] = None,
parent=None) -> QToolButton:
btn = QToolButton()
btn.setIcon(icon)
btn.setToolTip(tooltip)
Expand All @@ -382,10 +383,22 @@ def tool_btn(icon: QIcon, tooltip: str = '', checkable: bool = False, base: bool
btn.setProperty('base', True)
if icon_resize:
btn.installEventFilter(ButtonPressResizeEventFilter(btn))

if transparent_:
transparent(btn)
if properties:
for prop in properties:
btn.setProperty(prop, True)
if parent:
btn.setParent(parent)
return btn


def frame(parent=None):
frame_ = QFrame(parent)
frame_.setFrameShape(QFrame.Shape.StyledPanel)
return frame_


class ExclusiveOptionalButtonGroup(QButtonGroup):
def __init__(self, parent=None):
super().__init__(parent)
Expand Down
6 changes: 5 additions & 1 deletion src/main/python/plotlyst/view/novel_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from src.main.python.plotlyst.view.icons import IconRegistry
from src.main.python.plotlyst.view.style.base import apply_border_image
from src.main.python.plotlyst.view.widget.button import SecondaryActionToolButton
from src.main.python.plotlyst.view.widget.events_map import EventsMindMapView
from src.main.python.plotlyst.view.widget.plot import PlotEditor


Expand Down Expand Up @@ -115,6 +116,9 @@ def __init__(self, novel: Novel):
self.ui.lblSynopsisWords.setWordCount(self.ui.textSynopsis.textEdit.statistics().word_count)
self.ui.textSynopsis.textEdit.textChanged.connect(self._synopsis_changed)

self._eventsMap = EventsMindMapView(self.novel)
self.ui.wdgEventsMapParent.layout().addWidget(self._eventsMap)

self.ui.wdgStructure.setNovel(self.novel)
self.ui.wdgTitle.setFixedHeight(150)
apply_border_image(self.ui.wdgTitle, resource_registry.frame1)
Expand All @@ -123,7 +127,7 @@ def __init__(self, novel: Novel):
self.ui.wdgPlotContainer.layout().addWidget(self.plot_editor)

self.ui.wdgTagsContainer.setNovel(self.novel)
self.ui.tabWidget.setCurrentWidget(self.ui.tabSynopsis)
self.ui.tabWidget.setCurrentWidget(self.ui.tabEvents)

@overrides
def refresh(self):
Expand Down
5 changes: 5 additions & 0 deletions src/main/python/plotlyst/view/style/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
background-color: #f8f9fa;
}
QFrame[rounded=true] {
border: 1px solid lightgrey;
border-radius: 6px;
}
QDialog[relaxed-white-bg] {
background-color: #f8f9fa;
}
Expand Down
20 changes: 20 additions & 0 deletions src/main/python/plotlyst/view/style/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,26 @@
padding: 4px;
}
QToolButton[transparent-rounded-bg-on-hover=true] {
border-radius: 4px;
border: 1px hidden lightgrey;
padding: 2px;
}
QToolButton::menu-indicator[transparent-rounded-bg-on-hover=true] {
width:0px;
}
QToolButton:hover[transparent-rounded-bg-on-hover=true] {
background: #EDEDED;
}
QToolButton:hover[events-sidebar=true] {
background: lightgrey;
}
QToolButton:checked[events-sidebar=true] {
background: #D4B8E0
}
QToolButton:hover[analysis-top-selector=true] {
background: lightgrey;
}
Expand Down
Loading

0 comments on commit df9dd73

Please sign in to comment.