Exemple #1
0
def find(jdID, content):
	date, time, detail, selftime = content['Date'], content['alphaTime'], content['eventDetail'], content['selfTime']
	selftime = None if 'value' not in selftime else selftime['value']
	year, month, day, hour, minute, __, detail = get_properties(date=date, time=time, detail=detail)

	nearest = True if 'value' in content['nearest'] else False
	reply_type = content['findAction']['value']

	event = Event(jdID=jdID, year=year, month=month, 
		day=day, hour=hour, minute=minute, event_detail=detail)
	find = Find(db=db, jdID=jdID, event=event, nearest=nearest, selftime=selftime)
	rst = find.find()
	return rst
Exemple #2
0
    def __init__(self, parent=None):
        # QtWidgets.QMainWindow.__init__(self, parent)
        super(Main, self).__init__()

        # Right layout for json
        self.j_tree = QtWidgets.QTreeView()
        # self.j_annot = QtWidgets.QTreeView()
        self.j_annot = QtWidgets.QPlainTextEdit()

        # Left layout for text doc
        # self.text_doc = QtWidgets.QPlainTextEdit()
        self.text_doc = TextEditor()

        self.filename = None
        self.bmks_filename = None
        self.data = None

        self.initUI()

        # Open the annotation
        self.j_tree.clicked.connect(self.openElement)

        # Show cursor pos
        self.j_tree.clicked.connect(self.load_cursorPos)

        # Find the text
        self.findAction = QtWidgets.QAction(self)
        self.findAction.setShortcut('Ctrl+F')
        self.findAction.triggered.connect(Find(self).show)
        self.addAction(self.findAction)
Exemple #3
0
def run(mk, rm, mod, find, det, pg, p_opt):
    db = DB()
    cliOption = None
    printOption = None

    #Check which option is given
    if mk:
        cliOption = Make(db, mk)
    elif rm:
        cliOption = Remove(db, rm)
    elif mod:
        cliOption = Modify(db, mod)
    elif find:
        cliOption = Find(db, find)
    elif det:
        cliOption = Detail(db, det)
    elif p_opt:
        printOption = p_opt

    #Dummy lines

    # cur.execute("select * from todo where 1")
    # rows = cur.fetchall()

    # if rows:
    # 	for row in rows:
    # 		iregular = re.compile(r"(\d{4})[-](\d{2})[-](\d{2})\s(\d{2})[:](\d{2})")
    # 		iregular2 = re.compile(r"(\d{4})[-](\d{2})[-](\d{2})\s(\d{2})[:](\d{2})")

    # 		idue = row[2]
    # 		i_match = iregular.match(idue)

    # 		t = datetime.datetime.now()
    # 		now = iregular2.match(str(t))

    # 		for i in range(1,6):
    # 			if int(i_match.group(i)) < int(now.group(i)):
    # 				sql = "delete from todo where due = ?"

    # 				cur.execute(sql, (i_match.group(0)))
    # 				conn.commit()
    # 			elif int(i_match.group(i)) > int(now.group(i)):
    # 				break

    if cliOption != None:
        if cliOption.check():
            cliOption.execute()
        db.conn.close()
        return

    Plan(db, pg, printOption).show()
    db.conn.close()
Exemple #4
0
from company import LoadCompany
from down import Download
from selenium import webdriver
import time
from read import CreateHtml
from find import Find
from stock import CreateStockHtml


driver = webdriver.Chrome()
comps = LoadCompany()
CreateStockHtml(comps)

for comp in comps:
    print(comp.symbol)
    print('<<{0} ({1}) 데이터 수집 시작>> '.format(comp.symbol, comp.name))
    Download(driver, comp.symbol)
    time.sleep(10)
    CreateHtml(comp.symbol)

command = ''
while command.upper() != 'EXIT':
   want = input("원하는 회사 코드를 입력하세요(종료를 원할 시 EXIT 입력): ")
   Find(want)
Exemple #5
0
class Application_Menu:

    find_var = Find()
    notes_uuid = []
    notes_gtk_object = []

    def create_note(self,widget = None,note = None):
        print note
        if note is not None:
            print "here"

            note = Revealer_Glade(widget,self,note)



        else:
            note = Revealer_Glade(widget, self,path=None)


        self.add_notes_to_menu(note )

    def __init__(self):
        indicator = appindicator.Indicator.new("Stickies",
                                               "stickies",
                                               appindicator.IndicatorCategory.APPLICATION_STATUS)
        indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
        #indicator.set_icon
        self.menu = Gtk.Menu()

        create_item = Gtk.MenuItem("New Note")
        create_item.connect("activate",self.create_note)
        find_item = Gtk.MenuItem("Find")
        find_item.set_sensitive(False)
        show_item = Gtk.MenuItem("Notes")
        note_items = Gtk.Menu()
        show_item.set_submenu(note_items)


        show_notes = Gtk.MenuItem("Show All")

        show_notes.connect("activate",self.show_all_notes)



        hide_notes = Gtk.MenuItem("Hide All")
        hide_notes.connect("activate",self.hide_all_notes)

        expand_all = Gtk.MenuItem("Expand All")
        expand_all.connect("activate", self.expand_all_notes)

        collapse_all = Gtk.MenuItem("Collapse All")
        collapse_all.connect("activate", self.collapse_all_notes)





        about_item = Gtk.MenuItem("About")
        about_item.connect("activate",self.about_stickies)
        quit_item = Gtk.MenuItem("Quit")
        quit_item.connect("activate",self.quit_application)
        self.menu.append(create_item)
        self.menu.append(Gtk.SeparatorMenuItem())
        self.menu.append(find_item)
        find_item.connect("activate",self.find_operation)
        self.menu.append(Gtk.SeparatorMenuItem())

        self.menu.append(show_notes)
        self.menu.append(hide_notes)
        self.menu.append(Gtk.SeparatorMenuItem())
        self.menu.append(show_item)
        self.menu.append(Gtk.SeparatorMenuItem())
        self.menu.append(expand_all)
        self.menu.append(collapse_all)
        self.menu.append(Gtk.SeparatorMenuItem())
        self.menu.append(about_item)
        self.menu.append(quit_item)

        indicator.set_menu(self.menu)


        for i in self.menu.get_children():
            i.show()

        self.initialize_notes()

        logger.info("Starting Gtk loop")
        if self.menu is not None:
            Gtk.main()

    """
        *add color icon
        *Purple
        *Blue
        *Peach
        *Yellow
    """
    def add_notes_to_menu(self, note):
        label = ""
        icon = ""
        print note
        if note.title:
            logger.debug("note.title is set")
            label = note.title

        else:
            label = str(note.uuid)
            logger.debug("title not set")
        icon = note.color_text
        logger.debug("This should be the icon: " +  icon)





        note_gtk_item =  Gtk.ImageMenuItem.new_with_label(label)
        logger.debug(icon)
        note_gtk_item.set_image(Gtk.Image.new_from_icon_name(icon.strip()  ,Gtk.IconSize.LARGE_TOOLBAR))
        note_gtk_item.set_always_show_image(True)
        note_gtk_item.connect("activate",self.note_clicked)
        print(self.menu.get_children()[7].get_label())
        self.menu.get_children()[7].get_submenu().append(note_gtk_item)
        note_gtk_item.show();


    def find_operation(self,widget):

        logger.debug(" FInd clicked, in find_operation()")


        logger.debug(type(self.find_var))

        self.find_var.show()


    def remove_deleted_note_from_menu(self,title):
        for i in self.menu.get_children()[7].get_submenu().get_children():
            if title == i.get_label():
                self.menu.get_children()[7].get_submenu().remove(i)
                break

    def change_the_title_of_note_in_menu(self,old_title,new_title):

    	print "|||||||||||||||"*20
    	print "tile cchanged" + new_title

        for i in self.menu.get_children():
            logger.debug("in loop")

            logger.debug(i.get_label())

            if (i.get_submenu()):
                logger.debug("Submenu is here")

                for j in i.get_submenu().get_children():

                    logger.debug("---->" +  j.get_label())



        for i in self.menu.get_children()[7].get_submenu().get_children():

            if old_title == i.get_label():
                GObject.idle_add(i.set_label,new_title)


    def change_item_icon(self,title,icon):


        for i in self.menu.get_children():
            logger.debug("in loop")

            logger.debug(i.get_label())

            if (i.get_submenu()):
                logger.debug("Submenu is here")

                for j in i.get_submenu().get_children():

                    logger.debug("---->" +  j.get_label())



        for i in self.menu.get_children()[7].get_submenu().get_children():

            if title == i.get_label():
                GObject.idle_add(i.set_image,Gtk.Image.new_from_icon_name(icon, Gtk.IconSize.LARGE_TOOLBAR))

                logger.debug("Icon changed to: ", str(icon))

    def note_clicked(self,widget):


        logger.debug(widget.get_label() + " was clicked + it will be shown now")

        for i in Revealer_Glade.notes_list:

            if str(i.uuid) == widget.get_label() or i.title == widget.get_label():
                GObject.idle_add(i.window.show)
                i.move_window()
                GObject.idle_add(i.window.set_keep_above,True)
                GObject.idle_add(i.window.set_keep_above,False)




    def read_backups(self):

        logger.info("Initialising path-- " + home + "/.stickies-data/*.txt")
        logger.debug(glob.glob(home + "/.stickies-data/*.txt"))
        #print glob.glob(home + "/stickies-data/*.txt")


        list = glob.glob(home + "/.stickies-data/*.txt")

        return list




    def initialize_notes(self):


        lst = self.read_backups()

        if lst:
            for note in lst:
                print note
                self.create_note(None,note)
        # else:
        #     self.create_note(self.menu,None)
        else:
            self.create_note(self.menu,None)
        logger.info("Starting Gtk loop")
        if self.menu is not None:
            Gtk.main()

    def show_all_notes(self,widget):

        if not Revealer_Glade.notes_list:
            self.initialize_notes()
        else:
            for i in Revealer_Glade.notes_list:
                i.save_sticky()
                GObject.idle_add(i.window.show)
                i.move_window()
                GObject.idle_add(i.window.set_keep_above,True)
                GObject.idle_add(i.window.set_keep_above,False)

    def hide_all_notes(self,widget):


        for i in Revealer_Glade.notes_list:
            i.save_sticky()
            GObject.idle_add(i.window.hide)

    """

    TODO: Add expand_all_notes and collapse_all_notes functions
    """

    def expand_all_notes(self,widget):
        for i in Revealer_Glade.notes_list:
            i.reveal_window()

    def collapse_all_notes(self,widget):
        for i in Revealer_Glade.notes_list:
            i.collapse_window()




    def about_stickies(self,widget):
        dialog = Gtk.AboutDialog.new()
        # fixes the "mapped without transient parent" warning
        dialog.set_transient_for(widget.get_parent().get_parent())

        dialog.set_program_name("Stickies")
        dialog.add_credit_section("Authors:", ['Nishant Kukreja (github.com/rubyace71697)'])
        dialog.set_license_type(Gtk.License.GPL_3_0)
        dialog.set_website("https://github.com/rubyAce71697/sticky-notes")
        dialog.set_website_label("Github Page")
        dialog.set_comments("Utility for ubuntu (inspired from stickies for mac)")
        dialog.set_logo_icon_name(os.path.dirname(os.path.abspath(__file__)) +"/stickies.png")
        print os.path.dirname(os.path.abspath(__file__)) + "/stickies.png"

        dialog.run()
        dialog.destroy()

    def quit_application(self,widget):
        for note in Revealer_Glade.notes_list:
            note.save_sticky()


        Gtk.main_quit()
Exemple #6
0
        return


if __name__ == '__main__':
    """ 程序安装路径,根据自己情况修改 """
    install_dir = '/home/superhui/Informationretrieval/IR'
    dir_path = os.path.join(install_dir, 'BigHW_IR/data')
    idx = indexer(os.path.join(dir_path, 'doc'))
    idx.build_indexer()
    dic = Singlestringcomp.read_dic(
        os.path.join(dir_path, 'global_index/glo_dic'))
    inverted_index = Gamma.read_invert_index_decode(
        os.path.join(dir_path, 'global_index/glo_index_encode'))

    document_num = idx.get_document_num()
    fd = Find(dic, inverted_index, document_num)
    """ 查询方法为布尔,顺序为从左到右 """
    helpinfo = "\
                \t-q: quit the program!\n \
                \t-s: statistic information!\n \
                \t-c: clear screen!\n \
                \t-x: \n \
                \t    for example:\n \
                \t\t-x an & name | be  =>  (an & name) | be\n \
                \t-h: get help!\n \
               "

    print helpinfo
    while True:
        user_input = raw_input('input key words>>')
        if user_input[:2] == '-q':
Exemple #7
0
def help(jdID):
	e = Find(jdID=jdID, db=db)
	rst = e.help()
	return rst
Exemple #8
0
        dest='depth',
        action='store_true',
        help=
        'Check for word patterns from base_dir in all directories recursively.'
        'Defaults to files in base_dir only if not set.')
    parser.add_argument('-i',
                        dest='ignore_case',
                        action='store_true',
                        help='Turn on ignore case for word search.')

    args = parser.parse_args()

    # First check if the base directory exist
    if not os.path.isdir(args.base_dir):
        print('Base directory %s does not exist.' % args.base_dir)
        exit(1)

    if not args.depth:
        depth = 0
    else:
        depth = 100

    find = Find()
    # results = find.find(args.base_dir, args.pattern, args.search_type, args.ignore_case)
    file_list = find.find(args.base_dir, args.file_pattern, depth, 'f', True)
    grep = Grep()
    grep.grep(args.word_pattern, file_list, args.ignore_case)
    grep.print_results()
    # Test to just get the results as opposed to calling the class print_results()
    #results = grep.get_results()
    #print('\n\n', results)