Fixed merge conflict
This commit is contained in:
commit
1a5b804ee2
30
GUI/configImporter.py
Normal file
30
GUI/configImporter.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import ConfigParser
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigImporter():
|
||||||
|
def __init__(self, filename):
|
||||||
|
"""Read the filename into the parser."""
|
||||||
|
self.filename = filename
|
||||||
|
self.parser = ConfigParser.ConfigParser()
|
||||||
|
self.parser.read(self.filename)
|
||||||
|
|
||||||
|
def load_common_attributes(self):
|
||||||
|
"""Loads common attributes from the initialized file."""
|
||||||
|
try:
|
||||||
|
return self.parser.get('GUI_Options', 'CommonParameters')
|
||||||
|
except:
|
||||||
|
return 'One, Two, Three'
|
||||||
|
|
||||||
|
def load_output_types(self):
|
||||||
|
"""Loads output types from the initialized file."""
|
||||||
|
try:
|
||||||
|
return self.parser.get('GUI_Options', 'OutputTypes')
|
||||||
|
except:
|
||||||
|
return 'csv'
|
||||||
|
|
||||||
|
def load_always_attributes(self):
|
||||||
|
"""Loads attributes that are always searched for from the initialized file."""
|
||||||
|
try:
|
||||||
|
return self.parser.get('GUI_Options', 'AlwaysParameters')
|
||||||
|
except:
|
||||||
|
return 'Name, Weight'
|
33
GUI/gui.py
33
GUI/gui.py
@ -1,38 +1,11 @@
|
|||||||
from Tkinter import *
|
from Tkinter import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class ConfigImporter():
|
from configImporter import *
|
||||||
def __init__(self, filename):
|
|
||||||
"""Read the filename into the parser."""
|
|
||||||
import ConfigParser
|
|
||||||
self.filename = filename
|
|
||||||
self.parser = ConfigParser.ConfigParser()
|
|
||||||
self.parser.read(self.filename)
|
|
||||||
|
|
||||||
|
|
||||||
def load_common_attributes(self):
|
|
||||||
"""Loads common attributes from the initialized file."""
|
|
||||||
try:
|
|
||||||
return self.parser.get('GUI_Options', 'CommonParameters')
|
|
||||||
except:
|
|
||||||
return 'One, Two, Three'
|
|
||||||
|
|
||||||
def load_output_types(self):
|
|
||||||
"""Loads output types from the initialized file."""
|
|
||||||
try:
|
|
||||||
return self.parser.get('GUI_Options', 'OutputTypes')
|
|
||||||
except:
|
|
||||||
return 'csv'
|
|
||||||
|
|
||||||
def load_always_attributes(self):
|
|
||||||
"""Loads attributes that are always searched for from the initialized file."""
|
|
||||||
try:
|
|
||||||
return self.parser.get('GUI_Options', 'AlwaysParameters')
|
|
||||||
except:
|
|
||||||
return 'Name, Weight'
|
|
||||||
|
|
||||||
class GUI():
|
class GUI():
|
||||||
def __init__(self, search, config_file='GUI/gui.cfg', sourceloader = None, in_source=True):
|
def __init__(self, search, config_file='GUI/gui.cfg', sourceloader=None, in_source=True):
|
||||||
"""Boots the window, configuration."""
|
"""Boots the window, configuration."""
|
||||||
if in_source:
|
if in_source:
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
@ -168,7 +141,7 @@ class GUI():
|
|||||||
print "No known class, {}, {}".format(name, var)
|
print "No known class, {}, {}".format(name, var)
|
||||||
|
|
||||||
self.values = values
|
self.values = values
|
||||||
if all([values.get(i)!='' for i in self.required_variables]):
|
if all([values.get(i) != '' for i in self.required_variables]):
|
||||||
self.finish_with_search = True
|
self.finish_with_search = True
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
else:
|
else:
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
Fourmi, a web scraper build to search specific information for a given compound (and it's pseudonyms).
|
Fourmi, a web scraper build to search specific information for a given compound (and it's pseudonyms).
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
fourmi
|
||||||
fourmi search <compound>
|
fourmi search <compound>
|
||||||
fourmi [options] search <compound>
|
fourmi [options] search <compound>
|
||||||
fourmi [options] [-v | -vv | -vvv] [--include=<sourcename> | --exclude=<sourcename>] search <compound>
|
fourmi [options] [-v | -vv | -vvv] [--include=<sourcename> | --exclude=<sourcename>] search <compound>
|
||||||
@ -24,6 +25,7 @@ Options:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
from scrapy.crawler import Crawler
|
from scrapy.crawler import Crawler
|
||||||
from scrapy import signals, log
|
from scrapy import signals, log
|
||||||
import docopt
|
import docopt
|
||||||
@ -31,6 +33,7 @@ import docopt
|
|||||||
from FourmiCrawler.spider import FourmiSpider
|
from FourmiCrawler.spider import FourmiSpider
|
||||||
from utils.configurator import Configurator
|
from utils.configurator import Configurator
|
||||||
from utils.sourceloader import SourceLoader
|
from utils.sourceloader import SourceLoader
|
||||||
|
from GUI import gui
|
||||||
|
|
||||||
|
|
||||||
def setup_crawler(compound, settings, source_loader, attributes):
|
def setup_crawler(compound, settings, source_loader, attributes):
|
||||||
@ -82,3 +85,6 @@ if __name__ == '__main__':
|
|||||||
elif arguments["list"]:
|
elif arguments["list"]:
|
||||||
print "-== Available Sources ==-"
|
print "-== Available Sources ==-"
|
||||||
print str(loader)
|
print str(loader)
|
||||||
|
else:
|
||||||
|
gui_window = gui.GUI(search, sourceloader=SourceLoader())
|
||||||
|
gui_window.run()
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
from fourmi import search
|
|
||||||
from GUI import gui
|
|
||||||
from utils.sourceloader import SourceLoader
|
|
||||||
|
|
||||||
|
|
||||||
gui_window = gui.GUI(search, sourceloader=SourceLoader())
|
|
||||||
gui_window.run()
|
|
Reference in New Issue
Block a user