Skip to content

Commit

Permalink
Revert "Merge branch 'master' of github.com:QuailTeam/iQuail into new…
Browse files Browse the repository at this point in the history
…_solutions"

This reverts commit 17ae5bc, reversing
changes made to baddffa.
  • Loading branch information
mouuff committed Dec 9, 2019
1 parent d3fda37 commit b6c674e
Show file tree
Hide file tree
Showing 39 changed files with 98 additions and 519 deletions.
11 changes: 0 additions & 11 deletions DONE

This file was deleted.

9 changes: 2 additions & 7 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
dont mkdtemp

KeyboardInterrupt err
tmp size?


key signature
Option to verify solution (conf ignore & iquail update)
Logging!!!


Change solution[] path
Expand Down
19 changes: 0 additions & 19 deletions examples/allum1.py

This file was deleted.

16 changes: 3 additions & 13 deletions examples/cmder_gui.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/usr/bin/python3
import os
import iquail
import logging


logging.basicConfig(
level=logging.DEBUG,
filename=os.path.join(os.path.dirname(__file__), '..', 'iquail.log'),
)
import iquail

if not iquail.helper.OS_WINDOWS:
raise AssertionError("This test solution is windows only")
Expand All @@ -28,9 +21,7 @@ def next_pressed(self):


iquail.run(
solution=iquail.SolutionGitHub(
iquail.ConfVar("zip_url", default_value="cmder_mini.zip"),
"https://github.com/cmderdev/cmder"),
solution=iquail.SolutionGitHub(iquail.ConfVar("zip_url"), "https://github.com/cmderdev/cmder"),
installer=iquail.Installer(
publisher='cmderdev',
name='Cmder',
Expand All @@ -43,7 +34,6 @@ def next_pressed(self):
iquail.builder.CmdIcon('icon.ico'),
iquail.builder.CmdNoconsole()
),
controller=iquail.ControllerTkinter(
install_custom_frame=FrameSelectMiniOrFull),
controller=iquail.ControllerTkinter(install_custom_frame=FrameSelectMiniOrFull),
conf_ignore=["config/*"]
)
20 changes: 0 additions & 20 deletions examples/cmder_simple_gui.py

This file was deleted.

8 changes: 3 additions & 5 deletions examples/indie_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@ def register(self):


iquail.run(
solution=iquail.SolutionGitHub(
"indie.zip", "https://github.com/QuailTeam/cpp_indie_studio"),
solution=iquail.SolutionGitHub("indie.zip", "https://github.com/QuailTeam/cpp_indie_studio"),
installer=MyInstaller(
publisher='tek',
name='Indie',
icon='icon.png',
binary='indie_studio',
console=False,
launch_with_quail=False
launch_with_quail=True
),
builder=iquail.builder.Builder(
iquail.builder.CmdIcon('icon.png'),
iquail.builder.CmdNoconsole(),
side_img_override="./side_img.gif"
iquail.builder.CmdNoconsole()
),
controller=iquail.ControllerTkinter(ask_for_update=True,
eula="TEST")
Expand Down
21 changes: 0 additions & 21 deletions examples/old/cmder_local.py

This file was deleted.

3 changes: 1 addition & 2 deletions examples/openhardwaremonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
),
builder=iquail.builder.Builder(
iquail.builder.CmdIcon('icon.ico'),
iquail.builder.CmdNoconsole(),
side_img_override="side_img.gif",
iquail.builder.CmdNoconsole()
),
controller=iquail.ControllerTkinter()
)
Binary file removed examples/side_img.gif
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 3 additions & 18 deletions iquail/builder/builder.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
import os
import logging
from ..constants import Constants
from .. import helper

logger = logging.getLogger(__name__)


class Builder:
"""Build executable using PyInstaller
Takes BuildCmd as argument
"""

def __init__(self, *build_cmds, side_img_override=None):
self._side_img = helper.get_side_img_path()
if side_img_override is not None:
if os.path.basename(side_img_override) != Constants.SIDE_IMG_NAME:
raise AssertionError(
"side_img must of named: %s" % Constants.SIDE_IMG_NAME)
self._side_img = side_img_override
def __init__(self, *build_cmds):
self._build_cmds = list(build_cmds)

@property
def side_img(self):
return self._side_img

def register(self, builder_action):
"""see builder_action for more information"""
self._build_cmds.extend(builder_action.builder_cmds())

def default_build_params(self):
params = [helper.get_script(),
"--onefile",
'--add-data', self._side_img + os.path.pathsep + "iquail",
"--exclude-module", "PyInstaller",
"--exclude-module", "PIL"]
'--add-data', helper.get_side_img_path() + os.path.pathsep + "iquail",
"--exclude-module", "PyInstaller"]
if helper.OS_WINDOWS:
# upx slows down the launch time
params.append("--noupx")
Expand Down
7 changes: 1 addition & 6 deletions iquail/builder/cmd_zip.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import os
import zipfile
import logging
from .. import helper
from .cmd_base import CmdBase

logger = logging.getLogger(__name__)


class CmdZip(CmdBase):
""" Zip a folder and add it to the executable
"""

def __init__(self, path, zip_name, zip_clean=True):
super().__init__()
if isinstance(path, list):
Expand All @@ -28,8 +24,7 @@ def pre_build(self):
file_path = os.path.join(root, file)
zipf.write(file_path,
arcname=os.path.relpath(file_path, self._path))
logger.info("Adding file to zip: " +
os.path.relpath(file_path, self._path))
print(os.path.relpath(file_path, self._path))
zipf.close()

def post_build(self):
Expand Down
6 changes: 2 additions & 4 deletions iquail/constants.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@

class Constants:
ARGUMENT_PATH = "--iquail_path"
IQUAIL_TO_UPDATE = "iquail_update.exe" # TODO doc
SIDE_IMG_NAME = "side_img.gif" # TODO doc
IQUAIL_TO_UPDATE = "iquail.update.exe"
IQUAIL_ROOT_NAME = ".iquail"
ARGUMENT_UNINSTALL = "--iquail_uninstall"
ARGUMENT_BUILD = "--iquail_build"
ARGUMENT_RM = "--iquail_rm"
ARGUMENT_REPLACE = "--iquail_replace"
ARGUMENT_INSTALL_POLKIT = "--iquail_install_polkit"
ARGUMENT_RUN = "--iquail_run"
ARGUMENT_VALIDATE = "--iquail_validate"
CHECKSUMS_FILE = ".integrity.json"
INTEGRITY_IGNORE_FILE = ".integrity_ignore"
VERSION_FILE = "solution_version.txt"
CONF_IGNORE = ".conf_ignore" # TODO doc
CONF_IGNORE = ".conf_ignore" #TODO doc
CONFIG_FILE = "config.ini"
PATH_SEP = "::"
12 changes: 2 additions & 10 deletions iquail/controller/controller_base.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
from abc import ABC, abstractmethod
import sys
import logging
from ..errors import SolutionUnreachableError, SolutionNotRemovableError
from ..helper.traceback_info import ExceptionInfo


logger = logging.getLogger(__name__)


class ControllerBase(ABC):
__manager = None

Expand All @@ -29,19 +25,15 @@ def setup(self, manager):
@property
def manager(self):
if self.__manager is None:
raise AssertionError(
"manager is None, You must call Controller.setup() first")
raise AssertionError("manager is None, You must call Controller.setup() first")
return self.__manager

def excepthook(self, exctype, value, tb):
exc_info = ExceptionInfo(exctype, value, tb)
logger.error(exc_info.traceback_str)
if isinstance(value, SolutionNotRemovableError):
self.callback_solution_not_removable_error(exc_info)
elif isinstance(value, SolutionUnreachableError):
if isinstance(value, SolutionUnreachableError):
self.callback_solution_unreachable_error(exc_info)
elif isinstance(value, KeyboardInterrupt):
sys.__excepthook__(exctype, value, tb)
else:
self._excepthook(exc_info)

Expand Down
9 changes: 3 additions & 6 deletions iquail/controller/controller_tkinter/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def __init__(self,
self.title_font = None
self._ask_for_update = ask_for_update
tk.Tk.report_callback_exception = self.excepthook
assert install_custom_frame is None or issubclass(
install_custom_frame, FrameBase)
assert install_custom_frame is None or issubclass(install_custom_frame, FrameBase)
self.install_custom_frame = install_custom_frame

@property
Expand All @@ -190,8 +189,7 @@ def _start_tk(self, frame, title):
self.root_frame.pack(side="top", fill="both", expand=True)
self.root_frame.grid_rowconfigure(0, weight=1)
self.root_frame.grid_columnconfigure(0, weight=1)
self.title_font = Font(family='Helvetica', size=15,
weight="bold", slant="italic")
self.title_font = Font(family='Helvetica', size=15, weight="bold", slant="italic")
self.medium_font = Font(family='Helvetica', size=11)
# Select frame
self.switch_frame(frame)
Expand All @@ -213,8 +211,7 @@ def switch_frame(self, frame_class, **kwargs):
self._frame.tkraise()

def _excepthook(self, exception_info):
reporter = ErrorReporter(
"Automatic bug report", exception_info.traceback_str)
reporter = ErrorReporter("Automatic bug report", exception_info.traceback_str)
reporter.show()
self.quit_tk()

Expand Down
3 changes: 1 addition & 2 deletions iquail/controller/controller_tkinter/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ def choice2_selected(self):
class FrameBaseInProgress(FrameBase):
def __init__(self, parent, controller, label_str):
super().__init__(parent, controller)
self._label = tk.Label(self, text=label_str,
font=controller.title_font)
self._label = tk.Label(self, text=label_str, font=controller.title_font)
self._label.pack(side="top", fill="x", pady=10)
self.progress_var = tk.IntVar()
self._progress_bar = ttk.Progressbar(self,
Expand Down
12 changes: 3 additions & 9 deletions iquail/helper/configuration.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import logging
import configparser
from pathlib import Path

logger = logging.getLogger(__name__)


class ConfVar:
def __init__(self, key, cast=str, default_value=None):
def __init__(self, key, cast=str):
""" Configuration variable
It will be replaced by its configuration value when Configuration.apply is called
:param key: key which will be found in the configuration
:param cast: cast function (by default all configuration variables are strings)
"""
self.key = key
self.default_value = default_value
self.cast = cast


Expand Down Expand Up @@ -56,9 +52,7 @@ def apply(self, *instances):
instance_vars = instance.__dict__
for var_name, var_value in instance_vars.items():
if isinstance(var_value, ConfVar):
value = var_value.cast(self.get(var_value.key,
default=var_value.default_value))
value = var_value.cast(self.get(var_value.key))
if value is not None:
logger.info("Applying conf var: %s = %s" %
(var_name, str(value)))
setattr(instance, var_name, value)

Loading

0 comments on commit b6c674e

Please sign in to comment.