Skip to content

Commit

Permalink
format source code
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer-coding committed Jun 16, 2024
1 parent e3e6346 commit 3d7c42e
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 114 deletions.
11 changes: 6 additions & 5 deletions mesonui/containers/doublylist.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env python3


#
# author : Michael Brockus.  
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
# author : Michael Brockus.
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
#
# copyright 2020 The Meson-UI development team
#
class MesonUiNode:
def __init__(self, data_ptr = None, next_ptr = None, prev_ptr = None):
def __init__(self, data_ptr=None, next_ptr=None, prev_ptr=None):
self.data = data_ptr
self.next = next_ptr
self.prev = prev_ptr
Expand Down Expand Up @@ -38,7 +39,7 @@ def remove_item(self):
if self.is_empty():
return
else:
if(self.head != self.tail):
if self.head != self.tail:
self.head = self.head.next
self.head.previous = None
else:
Expand Down
19 changes: 13 additions & 6 deletions mesonui/dashboard/appdashboard.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
#!/usr/bin/env python3

#
# author : Michael Brockus.  
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
# author : Michael Brockus.
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
#
# copyright 2020 The Meson-UI development team
#
from .buildoptions import IntroBuildOptionsTab
from .projectinfo import IntroProjectInfoTab
from .tests import IntroTestlogInfoTab


class IntrospectionDashboard:
def __init__(self, context, meson_api):
super().__init__()
self._buildoptions: IntroBuildOptionsTab = IntroBuildOptionsTab(context=context, meson_api=meson_api)
self._projectinfo: IntroProjectInfoTab = IntroProjectInfoTab(context=context, meson_api=meson_api)
self._testloginfo: IntroTestlogInfoTab = IntroTestlogInfoTab(context=context, meson_api=meson_api)
self._buildoptions: IntroBuildOptionsTab = IntroBuildOptionsTab(
context=context, meson_api=meson_api
)
self._projectinfo: IntroProjectInfoTab = IntroProjectInfoTab(
context=context, meson_api=meson_api
)
self._testloginfo: IntroTestlogInfoTab = IntroTestlogInfoTab(
context=context, meson_api=meson_api
)

def update(self, meson_api: None):
self._buildoptions.update_introspection(meson_api)
Expand Down
12 changes: 6 additions & 6 deletions mesonui/dashboard/buildoptions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3

#
# author : Michael Brockus.  
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
# author : Michael Brockus.
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
#
# copyright 2020 The Meson-UI development team
#
Expand All @@ -18,7 +18,7 @@ def __init__(self, context, meson_api):

def setup_introspection(self):
head_ref = self._context._model.model_options().get_list().head
while (head_ref is not None):
while head_ref is not None:
new_item = QListWidgetItem(head_ref.data)
self._context.buildoptions_list.addItem(new_item)
head_ref = head_ref.next
Expand All @@ -30,11 +30,11 @@ def update_introspection(self, meson_api):

head_ref = self._context._model.model_options().get_list().head
if head_ref is None:
new_item = QListWidgetItem(f'No Project data.')
new_item = QListWidgetItem("No Project data.")
self._context.buildoptions_list.addItem(new_item)
return

while (head_ref is not None):
while head_ref is not None:
new_item = QListWidgetItem(head_ref.data)
self._context.buildoptions_list.addItem(new_item)
head_ref = head_ref.next
12 changes: 6 additions & 6 deletions mesonui/dashboard/projectinfo.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3

#
# author : Michael Brockus.  
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
# author : Michael Brockus.
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
#
# copyright 2020 The Meson-UI development team
#
Expand All @@ -18,7 +18,7 @@ def __init__(self, context, meson_api):

def setup_introspection(self):
head_ref = self._context._model.buildsysteminfo().get_list().head
while (head_ref is not None):
while head_ref is not None:
new_item = QListWidgetItem(head_ref.data)
self._context.projectinfo_list.addItem(new_item)
head_ref = head_ref.next
Expand All @@ -30,11 +30,11 @@ def update_introspection(self, meson_api):

head_ref = self._context._model.buildsysteminfo().get_list().head
if head_ref is None:
new_item = QListWidgetItem(f'No Project data.')
new_item = QListWidgetItem("No Project data.")
self._context.projectinfo_list.addItem(new_item)
return

while (head_ref is not None):
while head_ref is not None:
new_item = QListWidgetItem(head_ref.data)
self._context.projectinfo_list.addItem(new_item)
head_ref = head_ref.next
12 changes: 6 additions & 6 deletions mesonui/dashboard/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3

#
# author : Michael Brockus.  
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
# author : Michael Brockus.
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
#
# copyright 2020 The Meson-UI development team
#
Expand All @@ -18,7 +18,7 @@ def __init__(self, context, meson_api):

def setup_introspection(self):
head_ref = self._context._model.model_testlogsinfo().get_list().head
while (head_ref is not None):
while head_ref is not None:
new_item = QListWidgetItem(head_ref.data)
self._context.testsinfo_list.addItem(new_item)
head_ref = head_ref.next
Expand All @@ -30,11 +30,11 @@ def update_introspection(self, meson_api):

head_ref = self._context._model.model_testlogsinfo().get_list().head
if head_ref is None:
new_item = QListWidgetItem(f'No Testlogs data.')
new_item = QListWidgetItem("No Testlogs data.")
self._context.testsinfo_list.addItem(new_item)
return

while (head_ref is not None):
while head_ref is not None:
new_item = QListWidgetItem(head_ref.data)
self._context.testsinfo_list.addItem(new_item)
head_ref = head_ref.next
48 changes: 25 additions & 23 deletions mesonui/mesonuilib/appconfig/core.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3

#
# author : Michael Brockus.  
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
# author : Michael Brockus.
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
#
# copyright 2020 The Meson-UI development team
#
Expand All @@ -14,32 +14,34 @@
class MesonCoreConfig:
def __init__(self):
self.meson_configure: T.Dict = {
'--auto-features': None,
'--backend': None,
'--buildtype': None,
'--default-library': None,
'--layout': None,
'--unity': None,
'--warnlevel': None,
'--wrap-mode': None,
'--werror': None,# eithor --werror or ''
'--strip': None, # eithor --strip or ''
'--cmake-prefix-path': None,
'--pkg-config-path': None,
'--fatal-meson-warnings': None
"--auto-features": None,
"--backend": None,
"--buildtype": None,
"--default-library": None,
"--layout": None,
"--unity": None,
"--warnlevel": None,
"--wrap-mode": None,
"--werror": None, # eithor --werror or ''
"--strip": None, # eithor --strip or ''
"--cmake-prefix-path": None,
"--pkg-config-path": None,
"--fatal-meson-warnings": None,
}

def extract(self):
for conf in self.meson_configure:
if self.meson_configure[conf] is None:
raise MesonUiException('Meson cache failed do to "None" value found while loading value')
raise MesonUiException(
'Meson cache failed do to "None" value found while loading value'
)

return self.meson_configure

def config(self, option: T.AnyStr, value: T.AnyStr = '') -> None:
if option == '':
raise MesonUiException('Option key passed as empty string object')
if value == '':
raise MesonUiException('Value passed in as empty string object')
def config(self, option: T.AnyStr, value: T.AnyStr = "") -> None:
if option == "":
raise MesonUiException("Option key passed as empty string object")
if value == "":
raise MesonUiException("Value passed in as empty string object")

self.meson_configure[f'--{option}'] = value
self.meson_configure[f"--{option}"] = value
66 changes: 41 additions & 25 deletions mesonui/mesonuilib/backends/kdevelop.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3

#
# author : Michael Brockus.  
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
# author : Michael Brockus.
# contact: <mailto:[email protected]>
# license: Apache 2.0 :http://www.apache.org/licenses/LICENSE-2.0
#
# copyright 2020 The Meson-UI development team
#
Expand All @@ -21,45 +21,61 @@
class KDevelopBackend(BackendImplementionApi):
def __init__(self, meson_api: MesonAPI):
super(self.__class__, self).__init__(meson_api)
self.backend: str = '\'kdevelop\''
self.backend: str = "'kdevelop'"
self.buildoptions = BuildOption(meson_api=meson_api)
self.projectinfo = ProjectInfo(meson_api=meson_api)
self.mesoninfo = MesonInfo(meson_api=meson_api)
self.meson = Meson()

def generator(self):
logging.info(f'Generating {self.backend} project')
logging.info(f"Generating {self.backend} project")
self.generate_project()

def generate_project(self):
# Generate the .kdev4 file.
with open(join_paths(self.mesoninfo.builddir, f'{self.projectinfo.descriptive_name}.kdev4'), 'w') as file:
file.write('[Project]\n')
file.write('CreatedFrom=meson.build\n')
file.write('Manager=KDevMesonManager\n')
file.write(f'Name={self.projectinfo.descriptive_name}\n')
with open(
join_paths(
self.mesoninfo.builddir, f"{self.projectinfo.descriptive_name}.kdev4"
),
"w",
) as file:
file.write("[Project]\n")
file.write("CreatedFrom=meson.build\n")
file.write("Manager=KDevMesonManager\n")
file.write(f"Name={self.projectinfo.descriptive_name}\n")

# Make .kdev4/ directory.
if not os.path.exists(join_paths(self.mesoninfo.builddir, '.kdev')):
os.mkdir(join_paths(self.mesoninfo.builddir, '.kdev'))
if not os.path.exists(join_paths(self.mesoninfo.builddir, ".kdev")):
os.mkdir(join_paths(self.mesoninfo.builddir, ".kdev"))

# Generate the .kdev4/ file.
with open(join_paths(self.mesoninfo.builddir, '.kdev', f'{self.projectinfo.descriptive_name}.kdev4'), 'w') as file:
file.write('[Buildset]\n')
file.write(f'BuildItems=@Variant({self._variant()})\n\n')
with open(
join_paths(
self.mesoninfo.builddir,
".kdev",
f"{self.projectinfo.descriptive_name}.kdev4",
),
"w",
) as file:
file.write("[Buildset]\n")
file.write(f"BuildItems=@Variant({self._variant()})\n\n")

file.write('[MesonManager]\n')
file.write(f'Current Build Directory Index=0\n')
file.write(f'Number of Build Directories=1\n\n')
file.write("[MesonManager]\n")
file.write(f"Current Build Directory Index=0\n")
file.write(f"Number of Build Directories=1\n\n")

file.write('[MesonManager][BuildDir 0]\n')
file.write('Additional meson arguments=\n')
file.write(f'Build Build Path={self.mesoninfo.builddir}\n')
file.write(f'Meson Generator Backend={self.buildoptions.combo("backend").value}\n')
file.write(f'Meson executable={self.meson.exe}\n')
file.write("[MesonManager][BuildDir 0]\n")
file.write("Additional meson arguments=\n")
file.write(f"Build Build Path={self.mesoninfo.builddir}\n")
file.write(
f'Meson Generator Backend={self.buildoptions.combo("backend").value}\n'
)
file.write(f"Meson executable={self.meson.exe}\n")

def _variant(self) -> str:
variant: str = '\\x00\\x00\\x00\\t\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x0b\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x16'
variant: str = (
"\\x00\\x00\\x00\\t\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x0b\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x16"
)
for i in self.projectinfo.descriptive_name:
variant + f'\\x00{i}'
variant + f"\\x00{i}"
return variant
Loading

0 comments on commit 3d7c42e

Please sign in to comment.