Skip to content

Commit

Permalink
deploy: add install script to create shortcuts after installation
Browse files Browse the repository at this point in the history
  • Loading branch information
centaurialpha committed Apr 11, 2021
1 parent 6d35fed commit cc78922
Show file tree
Hide file tree
Showing 18 changed files with 188 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: [3.7, 3.8, 3.9]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: [3.7, 3.8, 3.9]

steps:
- name: Checkout
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ help:
@echo "lint -- run pycodestyle and flake8"
@echo "dist -- run python setup.py sdist"
@echo "deb -- build a .deb package"
@echo "rc -- buil resources"

rc:
pyrcc5 pireal/resources/resources.qrc -o pireal/resources.py

clean:
rm -rf `find -name "*pyc"`
Expand Down
9 changes: 1 addition & 8 deletions bin/pireal
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@
import os
import sys

# Esto es reemplazado en tiempo de instalación
INSTALLED_BASE_DIR = '@ BASE_DIR @'
if os.path.exists(INSTALLED_BASE_DIR):
project_base_dir = INSTALLED_BASE_DIR
else:
project_base_dir = os.path.abspath(os.path.dirname(os.path.dirname(
project_base_dir = os.path.abspath(os.path.dirname(os.path.dirname(
os.path.realpath(sys.argv[0]))))

if project_base_dir not in sys.path:
sys.path.insert(0, project_base_dir)

Expand All @@ -48,7 +42,6 @@ from pireal.core import logger # noqa
from pireal import resources # noqa
from pireal import main # noqa
# Set up logger
# logger.set_up(debug=args.debug, verbose=args.verbose)
logger.set_up(verbose=args.verbose)

main.start_pireal(args)
29 changes: 27 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
pireal (3.1.0) unstable; urgency=low
pireal (3.1.0) unstable; urgency=medium

* feature: new Makefile
* feature: new CI
* refactor: new Start Page (no QML)
* fix: translations and menu actions
* feat: replace QML ListView by QListView with custom delegate
* feat: settings dialog
* feat: new settings manager
* refactor: rename src by package name
* feature: add thread to check updates
* fix: set Qt.AA_EnableHighDpiScaling before QApplication is created
* feature: dark mode
* fix: font for platform
* feat: add Font Awesome icon/font application
* refactor: better and more tests
* refactor: module names and better fs
* feat: add own ordered set implementation
* feat: custom status bar
* fix: use QInputDialog in custom header
* feature: add translations eng/es
* fix color in null items
* fix: now ordered set has __setitem__ for updates
* fix: encoding when open file
* fix: add pireal.spec for PyInstaller
* feature: add script to build binary and generate installer
* deploy: add install script to create shortcuts after installation

-- Gabriel Acosta <[email protected]> Thu, 24 May 2018 12:41:00 -0300
-- Gabriel Acosta <[email protected]> Sun, 11 Apr 2021 11:36:06 -0300
2 changes: 2 additions & 0 deletions debian/pireal.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pireal.desktop /usr/share/applications/
pireal/resources/images/pireal_icon.png /usr/share/icons/
1 change: 1 addition & 0 deletions pireal.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ Name=Pireal
GenericName=Pireal
Comment=Educational tool for working with Relational Algebra
Exec=pireal
Icon=/usr/share/icons/pireal_icon.png
Terminal=false
Categories=Application;Education;
33 changes: 1 addition & 32 deletions pireal/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,9 @@

from pireal.dirs import LOGS_DIR

FORMAT = "[%(asctime)s] [%(levelname)-6s]: %(name)-22s:%(funcName)-5s %(message)s"
FORMAT = "[%(asctime)s] [%(levelname)-6s]: %(name)s:%(funcName)-5s %(message)s"
TIME_FORMAT = '%Y-%m-%d %H:%M:%S'

# class _Logger(object):
# LEVELS = {
# 'critical': 50,
# 'error': 40,
# 'warning': 30,
# 'info': 20,
# 'debug': 10,
# 'no': 0
# }

# def __init__(self):
# self.__level = 0 # Default not logging
# logging.basicConfig(format=FORMAT)
# self.__loggers = {}

# def __call__(self, name):
# if name not in self.__loggers:
# logger = logging.getLogger(name)
# self.__loggers[name] = logger
# logger.setLevel(self.__level)
# return self.__loggers[name]

# def set_level(self, level):
# """ Set level for all loggers """

# if level in self.LEVELS.keys():
# self.__level = self.LEVELS[level]
# for log in self.__loggers.keys():
# logger = self.__loggers[log]
# logger.setLevel(self.__level)


def set_up(verbose: bool):
root = logging.getLogger()
Expand Down
41 changes: 18 additions & 23 deletions pireal/gui/central_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
from pireal.gui.dialogs import (
preferences,
new_relation_dialog,
new_database_dialog
)
from pireal.gui.dialogs.new_database_dialog import DBInputDialog
from pireal.gui.lateral_widget import RelationItemType
from pireal.dirs import DATA_SETTINGS
from pireal import translations as tr
Expand Down Expand Up @@ -93,6 +93,10 @@ def recent_databases(self) -> list:
return self._recent_dbs

def remember_recent_database(self, path: str):
# TODO: FEISIMO
if path.endswith('pireal/resources/samples/database.pdb'):
return

if path in self._recent_dbs:
self._recent_dbs.remove(path)
logger.debug('adding %s to recent databases', path)
Expand All @@ -118,28 +122,19 @@ def create_database(self):

if self.created:
return self.__say_about_one_db_at_time()
dialog = new_database_dialog.NewDatabaseDialog(self)
dialog.created.connect(self.__on_wizard_finished)
dialog.show()

def __on_wizard_finished(self, *data):
"""This slot execute when wizard to create a database is finished"""
db_filepath = DBInputDialog.ask_db_name(parent=self)
if not db_filepath:
logger.debug('database name not provided')
return

pireal = Pireal.get_service("pireal")
if data:
db_name, location, fname = data
# Create a new data base container
db_container = database_container.DatabaseContainer()
# Associate the file name with the PFile object
pfile_object = pfile.File(fname)
# Associate PFile object with data base container
# and add widget to stacked
db_container.pfile = pfile_object
self.add_widget(db_container)
# Set window title
pireal.change_title(file_manager.get_basename(fname))
self.created = True
logger.debug("La base de datos ha sido creada con éxito")
pireal = Pireal.get_service('pireal')
db_container = database_container.DatabaseContainer()
pfile_object = pfile.File(db_filepath)
db_container.pfile = pfile_object
self.add_widget(db_container)
pireal.change_title(file_manager.get_basename(db_filepath))
self.created = True
logger.debug('database=%s has been created', db_filepath)

def __say_about_one_db_at_time(self):
logger.warning("Oops! One database at a time please")
Expand Down Expand Up @@ -270,7 +265,7 @@ def __sanitize_data(self, data):
# Header de una relación
tpoint = line.find(":")
if tpoint == -1:
raise Exception("Error de sintáxis en la línea {}".format(
raise Exception("Syntax error in {}".format(
line_count + 1))
table_name, line = line.split(":")
table_name = table_name[1:].strip()
Expand Down
5 changes: 4 additions & 1 deletion pireal/gui/database_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from pireal.dirs import DATA_SETTINGS
from pireal import translations as tr
from pireal.gui.main_window import Pireal
from pireal import settings

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -211,12 +212,14 @@ def save_query(self, editor):

def save_query_as(self, editor=None):
if not editor:
if self.query_container.currentWidget() is None:
return
editor = self.query_container.currentWidget().get_editor()
filename = QFileDialog.getSaveFileName(
self,
tr.TR_MSG_SAVE_QUERY_FILE,
editor.name,
"Pireal query files(*.pqf)"
settings.get_extension_filter('.pqf')
)
filename = filename[0]
if not filename:
Expand Down
13 changes: 7 additions & 6 deletions pireal/gui/dialogs/about_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ def __init__(self, parent=None):
description.setFont(font)
vbox.addWidget(description)

# Web
web_lbl = QLabel("<a href='{0}'><span style='color: #3465a4'>"
"www.centaurialpha.github.io/pireal</span></a>")
web_lbl.setOpenExternalLinks(True)
web_lbl.setAlignment(Qt.AlignHCenter)
vbox.addWidget(web_lbl)
abuelo_agui_lbl = QLabel(
'In memory of my grandpa, Agui <span style="color: #EC7875"> </span>')
font = abuelo_agui_lbl.font()
font.setPointSize(8)
abuelo_agui_lbl.setFont(font)
abuelo_agui_lbl.setAlignment(Qt.AlignHCenter)
vbox.addWidget(abuelo_agui_lbl)

# Copyright
copy = QLabel("<br>Copyright © 2015-{year} - "
Expand Down
Loading

0 comments on commit cc78922

Please sign in to comment.