当前位置: 首页>>代码示例>>Python>>正文


Python DataBase.close方法代码示例

本文整理汇总了Python中database.DataBase.close方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.close方法的具体用法?Python DataBase.close怎么用?Python DataBase.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在database.DataBase的用法示例。


在下文中一共展示了DataBase.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __check_send_status

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def __check_send_status(self, button, status, receiver, message):
     flag = True
     for key in status.keys():
         if not status[key][1]:
             flag = False
             break
     if flag:
         button.set_sensitive(True)
         self.__spnnier.stop()
         failure = []
         for key in status.keys():
             if not status[key][0]:
                 failure.append(key)
         self.__generalize_status_bar()
         if not failure:
             self.__custom_status(True)
         else:
             self.__custom_status(False, failure)
         for failed in failure:
             receiver.remove(failed)
         if receiver:
             database = DataBase()
             database.save_message(message, receiver, time_stamp())
             database.close()
         return False
     return True
开发者ID:dibyendu,项目名称:WayToSms,代码行数:28,代码来源:interface.py

示例2: __selection_change

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
    def __selection_change(self, view):
        '''
        this method is called when a new
        row in the tree view is selected
        '''

        rows = view.get_selection().get_selected()
        message = rows[0].get_value(rows[1], 6).replace('&', '&').replace(
					     '<', '&lt;').replace('>', '&gt;')
        receiver = rows[0].get_value(rows[1], 7).split(',')
        database = DataBase()
        receiver = database.get_contact_name(receiver)
        sender = rows[0].get_value(rows[1], 8)
        database.close()
        self.message_store.clear()
        self.message_scroll.show_all()
        name = ''
        number = ''
        for receipient in receiver:
            name += receipient[0] + '\n'
            number += receipient[1] + '\n'
        name = name[:-1]
        number = number[:-1]
        self.message_store.append(['<span font_desc="belgrano 12"><b>'
                                   + message + '</b></span>', number, name,
                                   sender, '#3890FF'])
        return
开发者ID:dibyendu,项目名称:WayToSms,代码行数:29,代码来源:history.py

示例3: _day_selected_cb

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def _day_selected_cb(self, widget, data=None):
     '''Select new day'''
     date_formated = date_format(self.calendar.get_date())
     db = DataBase(self.path)
     data = db.get(date_formated)
     db.close()
     tasks_model = TasksModel(data)
     self.tasks_list.set_model(tasks_model.get_model())
开发者ID:germanrs,项目名称:calendario,代码行数:10,代码来源:calendario.py

示例4: _delete_row_cb

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def _delete_row_cb(self, widget, data=None):
     '''Delete a row'''
     selection = self.tasks_list.get_selection()
     model, row_iter = selection.get_selected()
     row = model[row_iter]
     data = (row[0],)
     db = DataBase(self.path)
     db.delete(data)
     db.close()
     self.get_tasks()
开发者ID:germanrs,项目名称:calendario,代码行数:12,代码来源:calendario.py

示例5: mark_day

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def mark_day(self):
     '''Mark the days of the month with tasks'''
     date = date_format(self.calendar.get_date())
     #just the month
     data = (date[3:],) 
     db = DataBase(self.path)
     day_list = db.get_days(data)
     db.close()
     for i in day_list:
         self.calendar.mark_day(int(i))
开发者ID:germanrs,项目名称:calendario,代码行数:12,代码来源:calendario.py

示例6: confirm_exit

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
            def confirm_exit(unused):
                'confirms whether to remove the only user'

                from database import DataBase
                import sys
                database = DataBase()
                database.drop_default()
                database.close()
                message.destroy()
                sys.exit(0)
开发者ID:dibyendu,项目名称:WayToSms,代码行数:12,代码来源:account.py

示例7: re_log_in

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def re_log_in(unused_widget, unused_event):
     from way2sms import login
     import time
     database = DataBase()
     user = database.get_default()
     thread.start_new_thread(login, (str(user[0]), user[1], True))
     database.close()
     time.sleep(3.4)
     self.__generalize_status_bar()
     self.__push_status_message('<span font_desc="belgrano 10"><b>  Try to <span foreground="#0000FF">re send</span> once more</b></span>')
     return
开发者ID:dibyendu,项目名称:WayToSms,代码行数:13,代码来源:interface.py

示例8: get_tasks

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def get_tasks(self):
     '''Get the rows'''
     date_formated = date_format(self.calendar.get_date())
     db = DataBase(self.path)
     data = db.get(date_formated)
     reminder = db.get_reminder()
     db.close()
     tasks_model = TasksModel(data)
     reminder_model = TasksModel(reminder)
     self.tasks_list.set_model(tasks_model.get_model())
     self.reminder_list.set_model(reminder_model.get_model())
开发者ID:germanrs,项目名称:calendario,代码行数:13,代码来源:calendario.py

示例9: __update_database

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
    def __update_database(self, star, word):
        "updates database when a word is starred/unstarred"

        from database import DataBase
        import pickle

        database = DataBase()
        table = (len(word.query) > 1 and word.query[1] != " ") and word.query[:2] or word.query[:1]
        data = star.state == True and pickle.dumps(word) or None
        database.update(table.lower(), (word.query.lower(), data, "bengali"))
        database.close()
开发者ID:dibyendu,项目名称:Plexicon,代码行数:13,代码来源:design.py

示例10: marker

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def marker(selected):
     database = DataBase()
     for index in range(32):
         calendar.unmark_day(index)
     for item in database.get_dates(selected):
         calendar.mark_day(item[0])
     database.close()
     if selected[0] != self.__cur[2] or selected[1] + 1 != self.__cur[1]:
         calendar.unmark_day(self.__cur[0])
     else:
         calendar.mark_day(self.__cur[0])
     return
开发者ID:dibyendu,项目名称:WayToSms,代码行数:14,代码来源:history.py

示例11: _filter_query_cb

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def _filter_query_cb(self, widget, data=None):
     '''Query for filter the tasks'''
     category = self.combobox_q_category.get_active()
     priority = self.combobox_q_priority.get_active()
     self.combobox_q_category.set_active(-1)
     self.combobox_q_priority.set_active(-1)
     date_formated = date_format(self.calendar.get_date())
     data = (date_formated, category, priority)
     db = DataBase(self.path)
     tasks = db.filter_tasks(data)
     db.close()
     tasks_model = TasksModel(tasks)
     self.tasks_list.set_model(tasks_model.get_model())
开发者ID:germanrs,项目名称:calendario,代码行数:15,代码来源:calendario.py

示例12: __date_change

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
    def __date_change(self, calendar):
        'this method is called when a new date is selected'

        selected = calendar.get_date()

        def marker(selected):
            database = DataBase()
            for index in range(32):
                calendar.unmark_day(index)
            for item in database.get_dates(selected):
                calendar.mark_day(item[0])
            database.close()
            if selected[0] != self.__cur[2] or selected[1] + 1 != self.__cur[1]:
                calendar.unmark_day(self.__cur[0])
            else:
                calendar.mark_day(self.__cur[0])
            return

        if not selected[2]:
            return False
        thread.start_new_thread(marker, (selected,))
        calendar.select_day(0)
        database = DataBase()
        messages = database.get_message(selected)
        database.close()
        self.time_store.clear()
        self.message_scroll.hide_all()
        if messages[0] or messages[1]:
            suffix = {1:'st', 2:'nd', 3:'rd'}
            month = {0:'JAN', 1:'FEB', 2:'MAR', 3:'APR', 4:'MAY', 5:'JUN',
                     6:'JUL', 7:'AUG', 8:'SEP', 9:'OCT', 10:'NOV', 11:'DEC'}
            suffix = (suffix.has_key(selected[2] % 10) and (selected[2] < 10 \
                     or selected[2] > 20)) and suffix[selected[2] % 10] or 'th'
            month = month[selected[1]]
            date_tag = "<span font_desc='CrashNumberingGothic  12'><b>%s</b><sup>%s</sup>\
</span>  <span font_desc='CrashNumberingGothic  12'><b>%s</b></span>  <span font_desc='ca\
rbontype  12'><sup>'</sup><b>%s</b></span>" % (selected[2], suffix, month,
                                               selected[0] % 100)
            self.__date_tag.set_markup(date_tag)
            self.time_scroll.show_all()
        else:
            self.time_scroll.hide_all()
        if messages[0]:
            for message in messages[0]:
                self.time_store.append([message[0], message[1], message[2],
                    'AM', 'black', 'white', message[3], message[4], message[5]])
        if messages[1]:
            for message in messages[1]:
                self.time_store.append([message[0], message[1], message[2],
                    'PM', 'white', 'black', message[3], message[4], message[5]])
        return True
开发者ID:dibyendu,项目名称:WayToSms,代码行数:53,代码来源:history.py

示例13: __delete_user

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def __delete_user(self, unused):
     self.__generalize_status_bar()
     database = DataBase()
     edit_list = [contacts for contacts in self.__contact_box if
                  contacts.get_child().get_children()[0].get_active()]
     if not edit_list:
         self.__push_status_message('<span font_desc="belgrano 10">  Select at least <b><span foreground="#FF0000">one</span></b> contact</span>')
         return False
     contacts = [contact.get_contact_info()[1] for contact in edit_list]
     for number in contacts:
         database.delete('contacts', number)
     database.close()
     self.add_contacts()
     return False
开发者ID:dibyendu,项目名称:WayToSms,代码行数:16,代码来源:interface.py

示例14: _toggle_row_cb

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
 def _toggle_row_cb(self, widget, path):
     '''Toggle button row'''
     model = self.tasks_list.get_model()
     row_iter = model.get_iter(path)
     #row is a gtk.TreeModelRow()
     row = model[row_iter]
     row[4] = not row[4]
     #task, completed, id for the moment category and 
     #priority are excluded
     data = (row[4], row[0])
     db = DataBase(self.path)
     db.update(data)
     db.close()
     self.get_tasks()
开发者ID:germanrs,项目名称:calendario,代码行数:16,代码来源:calendario.py

示例15: page_set_thread

# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import close [as 别名]
def page_set_thread(page_dict, index, favourite, database_search):    ## function modified
    'each such 26 threads will create the 26 pages of the notebook'

    h_box = gtk.HBox(False, 20)
    v_box = gtk.VBox()
    h_box.pack_start(v_box)
    table = chr(ord('a') + index)
    database = DataBase()
    count = 0
    if database.row_count(table):
        words = database.select(table)
        count += 1
        link = gtk.LinkButton('')
        link.set_label(words[0][0])
        link.connect('clicked', linked, favourite, database_search)
        link.set_tooltip_text('click to search')
        alignment = gtk.Alignment(0, 0.5, 0, 0)
        alignment.add(link)
        v_box.pack_start(alignment)
    for number in range(26):
        if database.row_count(table + chr(ord('a') + number)):
            words = database.select(table + chr(ord('a') + number))
            for word in words:
                count += 1
                link = gtk.LinkButton('')
                link.set_label(word[0])
                link.connect('clicked', linked, favourite, database_search)
                link.set_tooltip_text('click to search')
                alignment = gtk.Alignment(0, 0.5, 0, 0)
                alignment.add(link)
                v_box.pack_start(alignment)
                if count >= 25:
                    count -= 25
                    alignment = gtk.Alignment(0, 0, 0, 0)
                    v_box = gtk.VBox()
                    alignment.add(v_box)
                    h_box.pack_start(alignment)
    database.close()
    alignment = gtk.Alignment(0, 0, 0, 0)
    alignment.add(h_box)
    scroll = gtk.ScrolledWindow()
    scroll.set_size_request(400, 400)
    scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    scroll.add_with_viewport(alignment)
    scroll.get_child().modify_bg(gtk.STATE_NORMAL,
                                 gtk.gdk.color_parse('#ffffff'))
    page_dict[chr(ord('A') + index)] = scroll
    return
开发者ID:dibyendu,项目名称:Plexicon,代码行数:50,代码来源:interface.py


注:本文中的database.DataBase.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。