-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
341 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import json | ||
import re | ||
|
||
import os | ||
|
||
def extract_content(text): | ||
pattern = r"\((.*?)\)" # 匹配()之间的内容 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from qbot.common.logging.logger import LOGGER as logger | ||
|
||
|
||
class GlobalEvent: | ||
MSG_TYPE_SERIES = 1 | ||
|
||
def __init__(self): | ||
self.observers = {} | ||
|
||
def add_observer(self, msg_type, observer): | ||
if msg_type in self.observers.keys(): | ||
self.observers[msg_type].append(observer) | ||
else: | ||
self.observers[msg_type] = [observer] | ||
|
||
def notify(self, msg_type, data): | ||
logger.info("[GlobalEvent] get a notify ...") | ||
# print("data: ", data) | ||
if msg_type in self.observers.keys(): | ||
for observer in self.observers[msg_type]: | ||
observer.handle_data(data) | ||
|
||
|
||
GlobalEvent = GlobalEvent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import wx | ||
|
||
|
||
def _pydate2wxdate(date): | ||
import datetime | ||
|
||
assert isinstance(date, (datetime.datetime, datetime.date)) | ||
tt = date.timetuple() | ||
dmy = (tt[2], tt[1] - 1, tt[0]) | ||
return wx.DateTimeFromDMY(*dmy) | ||
|
||
|
||
def _wxdate2pydate(date): | ||
import datetime | ||
|
||
assert isinstance(date, wx.DateTime) | ||
if date.IsValid(): | ||
ymd = map(int, date.FormatISODate().split("-")) | ||
return datetime.date(*ymd) | ||
else: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.