Skip to content

Commit

Permalink
<type>[optional scope]: <Fix Singleton>
Browse files Browse the repository at this point in the history
[
* V3 does not invoke __init__
* Cleanup some English
* Cleanup unused constant
* Make module less dependent on codeallyXXX variants
]

[#101]
  • Loading branch information
Humberto Sanchez II committed Jan 17, 2024
1 parent bb32212 commit 77e7258
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
pip install attrdict3
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython
pip install Deprecated~=1.2.14
pip install codeallybasic==1.0.0
pip install codeallyadvanced==1.0.0
pip install codeallybasic==1.1.0
pip install codeallyadvanced==1.1.0
pip install pyutmodelv2==2.1.0
- run:
name: run tests
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ keywords = ['pyut', 'graphical shapes', 'python',]

dependencies = [
'wxPython~=4.2.1',
'codeallybasic==1.0.0',
'codeallyadvanced==1.0.0',
'codeallybasic>=1.1.0',
'codeallyadvanced>=1.1.0',
'pyutmodelv2==2.1.0',
]

Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ buildlackey==1.6.3
mypy==1.8.0
mypy-extensions==1.0.0
types-Deprecated==1.2.9.20240106
types-setuptools==69.0.0.20240106
types-setuptools==69.0.0.20240115
typing_extensions==4.9.0
Deprecated==1.2.14

pyutmodelv2==2.1.0
codeallybasic==1.0.0
codeallyadvanced==1.0.0
codeallybasic==1.1.0
codeallyadvanced==1.1.0

wxPython~=4.2.1
12 changes: 6 additions & 6 deletions src/ogl/OglLinkFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from logging import Logger
from logging import getLogger

from codeallybasic.Singleton import Singleton
from codeallybasic.SingletonV3 import SingletonV3

from pyutmodelv2.enumerations.PyutLinkType import PyutLinkType

Expand Down Expand Up @@ -47,19 +47,19 @@ def getLinkType(link: OglAssociation) -> PyutLinkType:
return PyutLinkType.NOTELINK


class OglLinkFactory(Singleton):
class OglLinkFactory(metaclass=SingletonV3):
"""
This class is a factory to produce `OglLink` objects.
It works under the Factory Design Pattern model. Ask for a link
from this object, and it will return you what you was asking for.
from this object, and it will return an instance of request link.
"""
def init(self, *args, **kwargs):
# noinspection PyAttributeOutsideInit
def __init__(self):

self.logger: Logger = getLogger(__name__)

def getOglLink(self, srcShape, pyutLink, destShape, linkType: PyutLinkType):
"""
Used to get a OglLink of the given linkType.
Used to get an OglLink of the given linkType.
Args:
srcShape: Source shape
Expand Down
2 changes: 1 addition & 1 deletion src/ogl/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.0'
__version__ = '2.1.5'
5 changes: 2 additions & 3 deletions src/ogl/preferences/OglPreferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from configparser import ConfigParser

from codeallybasic.SingletonV2 import SingletonV2
from codeallybasic.SingletonV3 import SingletonV3
from codeallybasic.ConfigurationLocator import ConfigurationLocator

from miniogl.MiniOglColorEnum import MiniOglColorEnum
Expand All @@ -20,11 +20,10 @@
OGL_PREFS_NAME_VALUES = Dict[str, str]


class OglPreferences(SingletonV2):
class OglPreferences(metaclass=SingletonV3):

MODULE_NAME: str = 'ogl'
PREFERENCES_FILENAME: str = f'{MODULE_NAME}.ini'
THE_GREAT_MAC_PLATFORM: str = 'darwin'

SECTION_OGL_PREFERENCES: str = 'Ogl'
SECTION_DIAGRAM: str = 'Diagram'
Expand Down

0 comments on commit 77e7258

Please sign in to comment.