Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OWGrep: Add widget #107

Merged
merged 3 commits into from Jan 19, 2018

Conversation

Projects
None yet
4 participants
@janezd
Copy link
Contributor

commented Dec 21, 2017

A widget for getting the data from a text file, like a log.

Includes
  • Code changes
  • Tests
  • Documentation
auto_send = Setting(True)
find_text = Setting("")

re_number = re.compile(r"^([+-]?\d+([.,]\d+)?)$")

This comment has been minimized.

Copy link
@kernc

kernc Dec 21, 2017

Member

Doesn't match -.3

This comment has been minimized.

Copy link
@kernc

kernc Dec 21, 2017

Member

Outer parentheses are unnecessary.

self.file_changed()

def file_changed(self):
name = "/Users/janez/Desktop/out.out"

This comment has been minimized.

Copy link
@ajdapretnar

ajdapretnar Dec 21, 2017

Contributor

For testing, this should be disabled.

This comment has been minimized.

Copy link
@jerneju

jerneju Dec 21, 2017

Contributor

FileNotFoundError and I cannot open the widget.

column_names = line.split()
line = next(lines)
for i in range(self.use_lines):
data.append(line.split())

This comment has been minimized.

Copy link
@kernc

kernc Dec 21, 2017

Member

Love the undocumented state machine!

So this only splits matching lines by whitespace?

What if different lines have different number of tokens?

lines = iter(self.file_lines)
column_names = None
for line in lines:
if self.text in line:

This comment has been minimized.

Copy link
@kernc

kernc Dec 21, 2017

Member

Why can't text be a regex?

from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget, Msg, Output

This comment has been minimized.

Copy link
@jerneju

jerneju Dec 21, 2017

Contributor

Many other widgets have two newlines here.

copy.setShortcuts(QKeySequence(Qt.Key_C | Qt.ControlModifier))
in_view.addAction(copy)
for action in in_view.actions():
print(action.text())

This comment has been minimized.

Copy link
@jerneju

jerneju Dec 21, 2017

Contributor

This is probably here for debugging purposes.

@janezd janezd changed the title OWGrep: Add widget [WIP] OWGrep: Add widget Dec 21, 2017

@janezd

This comment has been minimized.

Copy link
Contributor Author

commented Dec 21, 2017

Oh, oh, stop it guys. :) That's something I quickly put together to show Feri how to make new widgets. It's a long long way from being done. I've just put it here to share it with Feri.

Big apologies for forgetting adding a WIP tag. No need to review it at this phase.

@janezd janezd changed the title [WIP] OWGrep: Add widget [WIP] [NO-RFC] OWGrep: Add widget Dec 21, 2017

@ajdapretnar

This comment has been minimized.

Copy link
Contributor

commented Dec 21, 2017

I don't think there has been a widget in the history of Orange that was reviewed as quickly as this one. 😆 We jumped at it like hungry wolves. 🐺

@janezd janezd force-pushed the janezd:owgrep branch from 1790345 to ab269ba Dec 22, 2017

@janezd janezd changed the title [WIP] [NO-RFC] OWGrep: Add widget [WIP] OWGrep: Add widget Dec 22, 2017

@janezd janezd force-pushed the janezd:owgrep branch from ab269ba to 5330a65 Dec 28, 2017

@janezd janezd changed the title [WIP] OWGrep: Add widget OWGrep: Add widget Dec 28, 2017

@janezd janezd changed the title OWGrep: Add widget [WIP] OWGrep: Add widget Dec 28, 2017

@janezd janezd force-pushed the janezd:owgrep branch from 5330a65 to 70c0623 Dec 28, 2017

@janezd janezd changed the title [WIP] OWGrep: Add widget OWGrep: Add widget Dec 28, 2017

@janezd janezd force-pushed the janezd:owgrep branch from 98acb91 to df3bad4 Dec 29, 2017

@jerneju

This comment has been minimized.

Copy link
Contributor

commented Jan 3, 2018

I cannot open file.

Traceback (most recent call last):
  File "/prototypes/widgets/owgrep.py", line 189, in browse_file
    self.open_file()
  File "/prototypes/widgets/owgrep.py", line 208, in open_file
    text = f.read()
  File "/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

👍 for the tests

@jerneju jerneju merged commit 7c32af5 into biolab:master Jan 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.