-
Notifications
You must be signed in to change notification settings - Fork 6
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
Dozer
committed
May 16, 2017
1 parent
a2a17d8
commit e2c25a6
Showing
6 changed files
with
114 additions
and
29 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,51 @@ | ||
import uuid | ||
|
||
from model.base_model import BaseModel | ||
from workflow.workflow import Item | ||
|
||
|
||
class TheUUID(BaseModel): | ||
def __init__(self): | ||
self.name = u'uuid' | ||
self.desc = u'UUID Converter' | ||
|
||
def convert(self, query): | ||
result = [] | ||
|
||
if not query: | ||
new_uuid = str(uuid.uuid4()) | ||
result += [ | ||
Item( | ||
title=u'New UUID', | ||
subtitle=new_uuid, | ||
arg=self.name + u'-uuid4:' + new_uuid, | ||
valid=True, | ||
icon=self.icon_path() | ||
) | ||
] | ||
else: | ||
if "-" in query: | ||
no_dash_uuid = query.replace('-', '') | ||
result += [ | ||
Item( | ||
title=u'UUID without dash', | ||
subtitle=no_dash_uuid, | ||
arg=self.name + u'-uuid-without-dash:' + no_dash_uuid, | ||
valid=True, | ||
icon=self.icon_path() | ||
) | ||
] | ||
|
||
if "-" not in query and len(query) == 32: | ||
formatted_uuid = "%s-%s-%s-%s-%s" % (query[0:8], query[8:12], query[12:16], query[16:20], query[20:]) | ||
result += [ | ||
Item( | ||
title=u'Formatted UUID', | ||
subtitle=formatted_uuid, | ||
arg=self.name + u'-formatted-uuid:' + formatted_uuid, | ||
valid=True, | ||
icon=self.icon_path() | ||
) | ||
] | ||
|
||
return result |