Skip to content

Commit

Permalink
Merge tag '3.32.0' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Apr 1, 2022
2 parents e889f28 + b8cd319 commit 7d399e7
Show file tree
Hide file tree
Showing 204 changed files with 4,117 additions and 1,991 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ jobs:
python-version: 3.8
tox_env: orange-latest
name: Latest
- os: ubuntu-18.04
python-version: 3.7
tox_env: orange-oldest
name: Oldest dependencies

services:
postgres:
Expand Down Expand Up @@ -101,12 +105,12 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-10.15, windows-2016]
os: [macos-10.15, windows-2019]
python-version: [3.7, 3.8, 3.9]
tox_env: [orange-released]
name: [Released]
include:
- os: windows-2016
- os: windows-latest
python-version: 3.8
tox_env: orange-latest
name: Latest
Expand Down
42 changes: 41 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,45 @@ Change Log
------------


[3.32.0] - 2022-04-01
--------------------
##### Enhancements
* Enable multitarget problem types for OWTestAndScore and OWPredictions ([#5848](../../pull/5848))
* Datetime format selection ([#5819](../../pull/5819))
* Predictions: Allow choosing a target ([#5790](../../pull/5790))
* Server embedder: use queue, handle unsuccessful requests at the end ([#5835](../../pull/5835))
* orange-canvas: Add cmd parameter to clear all settings/caches ([#5844](../../pull/5844))
* New icons and splash screen ([#5814](../../pull/5814))
* Use palette colors in more places ([#5680](../../pull/5680))
* File: explicit file format choice ([#5736](../../pull/5736))
* Learner widgets: Inform about potential problems when overriding preprocessors ([#5710](../../pull/5710))

##### Bugfixes
* Orange.data.Table: deprecated is_view and is_copy ([#5913](../../pull/5913))
* owrocanalysis: Fix an index error in custom tick calculation ([#5904](../../pull/5904))
* SOM: Fix crash when color is constant ([#5860](../../pull/5860))
* plotutils: Fix implicit conversion to int warning error ([#5874](../../pull/5874))
* Calibration: Fix crash on empty folds ([#5859](../../pull/5859))
* Scatter Plot: Replot when input features change ([#5837](../../pull/5837))
* Nomogram: Purge class_var values ([#5847](../../pull/5847))
* Scatter plot: Fix rotation of regression line label ([#5840](../../pull/5840))
* widgets.evaluate.utils: call resizeColumnsToContents before setting hidden header sections. ([#5851](../../pull/5851))
* tSNE, Freeviz: Set effective_data ([#5839](../../pull/5839))
* Linear Projection: Fix LDA ([#5828](../../pull/5828))
* Decorate overridden input data handler ([#5836](../../pull/5836))
* Table: from_file/from_url remove type conversion ([#5812](../../pull/5812))
* Group by: Restore aggregations if removed due to open context ([#5823](../../pull/5823))
* Ensure unlockable sparse arrays after Table.copy ([#5807](../../pull/5807))
* ExcelReader: Write roles ([#5810](../../pull/5810))
* owfeatureconstructor: Always update models on data change ([#5804](../../pull/5804))
* File: remove some resizing limits ([#5815](../../pull/5815))
* owfeaturestatistics: Fix implicit int conversion error on resize ([#5799](../../pull/5799))
* table_from_frame: replace nan with String.Unknown for string variable ([#5795](../../pull/5795))
* Update (and test) minimum dependencies ([#5781](../../pull/5781))
* test_owdistancematrix: Do not download data for testing ([#5773](../../pull/5773))
* Silhouette plot text width ([#5756](../../pull/5756))


[3.31.1] - 2022-01-07
--------------------
##### Bugfixes
Expand Down Expand Up @@ -1639,7 +1678,8 @@ Change Log
* Initial version based on Python 1.5.2 and Qt 2.3


[next]: https://github.com/biolab/orange3/compare/3.31.1...HEAD
[next]: https://github.com/biolab/orange3/compare/3.32.0...HEAD
[3.32.0]: https://github.com/biolab/orange3/compare/3.31.1...3.32.0
[3.31.1]: https://github.com/biolab/orange3/compare/3.31.0...3.31.1
[3.31.0]: https://github.com/biolab/orange3/compare/3.30.2...3.31.0
[3.30.2]: https://github.com/biolab/orange3/compare/3.30.1...3.30.2
Expand Down
34 changes: 29 additions & 5 deletions Orange/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from collections.abc import Iterable
import re
import warnings
from typing import Callable, Dict
from typing import Callable, Dict, Optional

import numpy as np
import scipy

from Orange.data import Table, Storage, Instance, Value
from Orange.data import Table, Storage, Instance, Value, Domain
from Orange.data.filter import HasClass
from Orange.data.table import DomainTransformationError
from Orange.data.util import one_hot
Expand Down Expand Up @@ -86,6 +86,9 @@ class Learner(ReprableWithPreprocessors):
#: A sequence of data preprocessors to apply on data prior to
#: fitting the model
preprocessors = ()

# Note: Do not use this class attribute.
# It remains here for compatibility reasons.
learner_adequacy_err_msg = ''

def __init__(self, preprocessors=None):
Expand All @@ -95,6 +98,7 @@ def __init__(self, preprocessors=None):
elif preprocessors:
self.preprocessors = (preprocessors,)

# pylint: disable=R0201
def fit(self, X, Y, W=None):
raise RuntimeError(
"Descendants of Learner must overload method fit or fit_storage")
Expand All @@ -106,8 +110,23 @@ def fit_storage(self, data):
return self.fit(X, Y, W)

def __call__(self, data, progress_callback=None):
if not self.check_learner_adequacy(data.domain):
raise ValueError(self.learner_adequacy_err_msg)

for cls in type(self).mro():
if 'incompatibility_reason' in cls.__dict__:
incompatibility_reason = \
self.incompatibility_reason(data.domain) # pylint: disable=assignment-from-none
if incompatibility_reason is not None:
raise ValueError(incompatibility_reason)
break
if 'check_learner_adequacy' in cls.__dict__:
warnings.warn(
"check_learner_adequacy is deprecated and will be removed "
"in upcoming releases. Learners should instead implement "
"the incompatibility_reason method.",
OrangeDeprecationWarning)
if not self.check_learner_adequacy(data.domain):
raise ValueError(self.learner_adequacy_err_msg)
break

origdomain = data.domain

Expand Down Expand Up @@ -176,6 +195,11 @@ def active_preprocessors(self):
def check_learner_adequacy(self, _):
return True

# pylint: disable=no-self-use
def incompatibility_reason(self, _: Domain) -> Optional[str]:
"""Return None if a learner can fit domain or string explaining why it can not."""
return None

@property
def name(self):
"""Return a short name derived from Learner type name"""
Expand Down Expand Up @@ -436,7 +460,7 @@ def fix_dim(x):
# Call the predictor
backmappers = None
n_values = []
if isinstance(data, (np.ndarray, scipy.sparse.csr.csr_matrix)):
if isinstance(data, (np.ndarray, scipy.sparse.csr_matrix)):
prediction = self.predict(data)
elif isinstance(data, Table):
backmappers, n_values = self.get_backmappers(data)
Expand Down
39 changes: 36 additions & 3 deletions Orange/canvas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,41 @@ def argument_parser(self) -> argparse.ArgumentParser:
"--clear-widget-settings", action="store_true",
help="Clear stored widget setting/defaults",
)
parser.add_argument(
"--clear-all", action="store_true",
help="Clear all settings and caches"
)
return parser

def setup_logging(self):
super().setup_logging()
make_sql_logger(self.options.log_level)

@staticmethod
def _rm_tree(path):
log.debug("rmtree '%s'", path)
shutil.rmtree(path, ignore_errors=True)

def clear_widget_settings(self):
log.info("Clearing widget settings")
self._rm_tree(widget_settings_dir(versioned=True))
self._rm_tree(widget_settings_dir(versioned=False))

def clear_caches(self): # pylint: disable=import-outside-toplevel
from Orange.misc import environ
log.info("Clearing caches")
self._rm_tree(environ.cache_dir())
log.info("Clearing data")
self._rm_tree(environ.data_dir(versioned=True))
self._rm_tree(environ.data_dir(versioned=False))

def clear_application_settings(self): # pylint: disable=no-self-use
s = QSettings()
log.info("Clearing application settings")
log.debug("clear '%s'", s.fileName())
s.clear()
s.sync()

def setup_application(self):
super().setup_application()
clear_settings_flag = os.path.join(widget_settings_dir(),
Expand All @@ -375,8 +404,12 @@ def setup_application(self):
options = self.options
if options.clear_widget_settings or \
os.path.isfile(clear_settings_flag):
log.info("Clearing widget settings")
shutil.rmtree(widget_settings_dir(), ignore_errors=True)
self.clear_widget_settings()

if options.clear_all:
self.clear_widget_settings()
self.clear_caches()
self.clear_application_settings()

notif_server = NotificationServer()
canvas.notification_server_instance = notif_server
Expand Down Expand Up @@ -410,7 +443,7 @@ def onPaletteChange():
app.paletteChanged.connect(onPaletteChange)
onPaletteChange()

def show_splash_message(self, message: str, color=QColor("#FFD39F")):
def show_splash_message(self, message: str, color=QColor("#FFFFFF")):
super().show_splash_message(message, color)

def create_main_window(self):
Expand Down
21 changes: 10 additions & 11 deletions Orange/canvas/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Orange Canvas Configuration
"""
import random
import uuid
import warnings

Expand Down Expand Up @@ -98,39 +99,37 @@ def application_icon():
Return the main application icon.
"""
path = pkg_resources.resource_filename(
__name__, "icons/orange-canvas.svg"
__name__, "icons/orange-256.png"
)
return QIcon(path)

@staticmethod
def splash_screen():
splash_n = random.randint(1, 3)
path = pkg_resources.resource_filename(
__name__, "icons/orange-splash-screen.png")
__name__, f"icons/orange-splash-screen-{splash_n:02}.png")
pm = QPixmap(path)

version = Config.ApplicationVersion
if version:
version_parsed = LooseVersion(version)
version_comp = version_parsed.version
version = ".".join(map(str, version_comp[:2]))
size = 21 if len(version) < 5 else 16
size = 13
font = QFont("Helvetica")
font.setPixelSize(size)
font.setBold(True)
font.setItalic(True)
font.setLetterSpacing(QFont.AbsoluteSpacing, 2)
metrics = QFontMetrics(font)
br = metrics.boundingRect(version).adjusted(-5, 0, 5, 0)
br.moveCenter(QPoint(436, 224))
br = metrics.boundingRect(version)
br.moveTopLeft(QPoint(171, 438))

p = QPainter(pm)
p.setRenderHint(QPainter.Antialiasing)
p.setRenderHint(QPainter.TextAntialiasing)
p.setFont(font)
p.setPen(QColor("#231F20"))
p.drawText(br, Qt.AlignCenter, version)
p.setPen(QColor("#000000"))
p.drawText(br, Qt.AlignLeft, version)
p.end()
return pm, QRect(88, 193, 200, 20)
return pm, QRect(23, 24, 200, 20)

@staticmethod
def widgets_entry_points():
Expand Down
Binary file added Orange/canvas/icons/orange-256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
88 changes: 0 additions & 88 deletions Orange/canvas/icons/orange-canvas.svg

This file was deleted.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Orange/canvas/icons/orange-splash-screen-02.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Orange/canvas/icons/orange-splash-screen-03.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Orange/canvas/icons/orange-splash-screen.png
Binary file not shown.
Binary file modified Orange/canvas/icons/orange.ico
Binary file not shown.

0 comments on commit 7d399e7

Please sign in to comment.