|
| 1 | +################################# |
| 2 | +# |
| 3 | +# Imports from useful Python libraries |
| 4 | +# |
| 5 | +################################# |
| 6 | + |
| 7 | +import locale |
| 8 | +import sys |
| 9 | + |
| 10 | +################################# |
| 11 | +# |
| 12 | +# Imports from CellProfiler |
| 13 | +# |
| 14 | +################################## |
| 15 | + |
| 16 | +import cellprofiler_core.module |
| 17 | +import cellprofiler_core.setting.text |
| 18 | + |
| 19 | +__doc__ = """\ |
| 20 | +DumbModule |
| 21 | +============ |
| 22 | +
|
| 23 | +**DumbModule** does nothing of importance. |
| 24 | +
|
| 25 | +
|
| 26 | +I am a module |
| 27 | +look at me, |
| 28 | +about as simple |
| 29 | +as could be. |
| 30 | +
|
| 31 | +| |
| 32 | +
|
| 33 | +============ ============ =============== |
| 34 | +Supports 2D? Supports 3D? Respects masks? |
| 35 | +============ ============ =============== |
| 36 | +NO NO NO |
| 37 | +============ ============ =============== |
| 38 | +
|
| 39 | +""" |
| 40 | + |
| 41 | +#raise NotImplementedError("DumbModule does nothing") |
| 42 | + |
| 43 | +class DumbModule(cellprofiler_core.module.Module): |
| 44 | + module_name = "DumbModule" |
| 45 | + category = "Info" |
| 46 | + |
| 47 | + variable_revision_number = 1 |
| 48 | + |
| 49 | + def create_settings(self): |
| 50 | + self.some_setting = cellprofiler_core.setting.text.Text("dumb setting", "i am a setting", doc="I do nothing at all") |
| 51 | + |
| 52 | + def settings(self): |
| 53 | + return [self.some_setting] |
| 54 | + |
| 55 | + def visible_settings(self): |
| 56 | + return [self.some_setting] |
| 57 | + |
| 58 | + def run(self, workspace): |
| 59 | + f = open("/Users/ngogober/Desktop/log.txt", "wt") |
| 60 | + f_repr = repr(f) |
| 61 | + f.close() |
| 62 | + |
| 63 | + labels = ["func name", "value"] |
| 64 | + encoding_info_table = [ |
| 65 | + ["locale.getdefaultlocale:", repr(locale.getdefaultlocale())], |
| 66 | + ["locale.getlocale", repr(locale.getlocale())], |
| 67 | + ["locale.getpreferredencoding (do not set)", repr(locale.getpreferredencoding(False))], |
| 68 | + ["locale.getpreferredencoding", repr(locale.getpreferredencoding())], |
| 69 | + ["sys.getfilesystemencoding", repr(sys.getfilesystemencoding())], |
| 70 | + ["filestream", f_repr], |
| 71 | + ] |
| 72 | + |
| 73 | + if self.show_window: |
| 74 | + workspace.display_data.statistics = encoding_info_table |
| 75 | + workspace.display_data.labels = labels |
| 76 | + else: |
| 77 | + print(encoding_info_table) |
| 78 | + |
| 79 | + def display(self, workspace, figure): |
| 80 | + statistics = workspace.display_data.statistics |
| 81 | + labels = workspace.display_data.labels |
| 82 | + figure.set_subplots((1, 1)) |
| 83 | + figure.subplot_table(0, 0, statistics, labels) |
0 commit comments