def add(self, hide=0): (y, m, d) = self.cal.get_date() t = time.mktime((y, m + 1, d, self.hour, self.min, 0, -1, -1, -1)) at = self.at_box.flags() & g.VISIBLE buffer = self.text.get_buffer() start = buffer.get_start_iter() end = buffer.get_end_iter() message = buffer.get_text(start, end, TRUE) soundval = self.sound_choice.get_active() if soundval == 2: # Sound disabled sfile = None senabled = True elif soundval == 1: # Custom sound sfile = self.sound_entry.get_filename() senabled = False else: # Default sound sfile = None senabled = False memo = Memo(t, message, at = at != 0, hidden = hide, \ soundfile = sfile, nosound = senabled ) if self.memo: memo_list.delete(self.memo, update=0) memo_list.add(memo) memo_list.warn_if_not_visible(memo)
def build(objtId, p): if (p.__class__.__name__ == 'AttackerParameters'): return Attacker(objtId, p.name(), p.description(), p.image(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'PersonaParameters'): return Persona(objtId, p.name(), p.activities(), p.attitudes(), p.aptitudes(), p.motivations(), p.skills(), p.intrinsic(), p.contextual(), p.image(), p.assumption(), p.type(), p.tags(), p.environmentProperties(), p.codes()) if (p.__class__.__name__ == 'AssetParameters'): return Asset(objtId, p.name(), p.shortCode(), p.description(), p.significance(), p.type(), p.critical(), p.criticalRationale(), p.tags(), p.interfaces(), p.environmentProperties()) if (p.__class__.__name__ == 'TemplateAssetParameters'): return TemplateAsset(objtId, p.name(), p.shortCode(), p.description(), p.significance(), p.type(), p.surfaceType(), p.accessRight(), p.properties(), p.rationale(), p.tags(), p.interfaces()) if (p.__class__.__name__ == 'TemplateRequirementParameters'): return TemplateRequirement(objtId, p.name(), p.asset(), p.type(), p.description(), p.rationale(), p.fitCriterion()) if (p.__class__.__name__ == 'TemplateGoalParameters'): return TemplateGoal(objtId, p.name(), p.definition(), p.rationale(), p.concerns(), p.responsibilities()) if (p.__class__.__name__ == 'SecurityPatternParameters'): return SecurityPattern(objtId, p.name(), p.context(), p.problem(), p.solution(), p.requirements(), p.associations()) if (p.__class__.__name__ == 'ComponentParameters'): return Component(objtId, p.name(), p.description(), p.interfaces(), p.structure(), p.requirements(), p.goals(), p.associations()) if (p.__class__.__name__ == 'ComponentViewParameters'): return ComponentView(objtId, p.name(), p.synopsis(), p.components(), p.connectors(), p.attackSurfaceMetric()) if (p.__class__.__name__ == 'ValueTypeParameters'): return ValueType(objtId, p.name(), p.description(), p.type(), p.score(), p.rationale()) if (p.__class__.__name__ == 'ClassAssociationParameters'): return ClassAssociation(objtId, p.environment(), p.headAsset(), p.headDimension(), p.headNavigation(), p.headType(), p.headMultiplicity(), p.headRole(), p.tailRole(), p.tailMultiplicity(), p.tailType(), p.tailNavigation(), p.tailDimension(), p.tailAsset(), p.rationale()) if (p.__class__.__name__ == 'GoalAssociationParameters'): return GoalAssociation(objtId, p.environment(), p.goal(), p.goalDimension(), p.type(), p.subGoal(), p.subGoalDimension(), p.alternative(), p.rationale()) if (p.__class__.__name__ == 'DependencyParameters'): return Dependency(objtId, p.environment(), p.depender(), p.dependee(), p.dependencyType(), p.dependency(), p.rationale()) if (p.__class__.__name__ == 'GoalParameters'): return Goal(objtId, p.name(), p.originator(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'ObstacleParameters'): return Obstacle(objtId, p.name(), p.originator(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'DomainPropertyParameters'): return DomainProperty(objtId, p.name(), p.description(), p.type(), p.originator(), p.tags()) if (p.__class__.__name__ == 'ThreatParameters'): return Threat(objtId, p.name(), p.type(), p.method(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'VulnerabilityParameters'): return Vulnerability(objtId, p.name(), p.description(), p.type(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'RiskParameters'): return Risk(objtId, p.name(), p.threat(), p.vulnerability(), p.tags(), p.misuseCase()) if (p.__class__.__name__ == 'ResponseParameters'): return Response(objtId, p.name(), p.risk(), p.tags(), p.environmentProperties(), p.responseType()) if (p.__class__.__name__ == 'CountermeasureParameters'): return Countermeasure(objtId, p.name(), p.description(), p.type(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'TaskParameters'): return Task(objtId, p.name(), p.shortCode(), p.objective(), p.assumption(), p.author(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'UseCaseParameters'): return UseCase(objtId, p.name(), p.author(), p.code(), p.actors(), p.description(), p.tags(), p.environmentProperties()) if (p.__class__.__name__ == 'MisuseCaseParameters'): return MisuseCase(objtId, p.name(), p.environmentProperties(), p.risk()) if (p.__class__.__name__ == 'DotTraceParameters'): return DotTrace(p.fromObject(), p.fromName(), p.toObject(), p.toName()) if (p.__class__.__name__ == 'EnvironmentParameters'): return Environment(objtId, p.name(), p.shortCode(), p.description(), p.environments(), p.duplicateProperty(), p.overridingEnvironment(), p.tensions()) if (p.__class__.__name__ == 'RoleParameters'): return Role(objtId, p.name(), p.type(), p.shortCode(), p.description(), p.environmentProperties()) if (p.__class__.__name__ == 'ResponsibilityParameters'): return Responsibility(objtId, p.name()) if (p.__class__.__name__ == 'ExternalDocumentParameters'): return ExternalDocument(objtId, p.name(), p.version(), p.date(), p.authors(), p.description()) if (p.__class__.__name__ == 'InternalDocumentParameters'): return InternalDocument(objtId, p.name(), p.description(), p.content(), p.codes(), p.memos()) if (p.__class__.__name__ == 'CodeParameters'): return Code(objtId, p.name(), p.type(), p.description(), p.inclusionCriteria(), p.example()) if (p.__class__.__name__ == 'MemoParameters'): return Memo(objtId, p.name(), p.description()) if (p.__class__.__name__ == 'DocumentReferenceParameters'): return DocumentReference(objtId, p.name(), p.document(), p.contributor(), p.description()) if (p.__class__.__name__ == 'ConceptReferenceParameters'): return ConceptReference(objtId, p.name(), p.dimension(), p.objectName(), p.description()) if (p.__class__.__name__ == 'PersonaCharacteristicParameters'): return PersonaCharacteristic(objtId, p.persona(), p.qualifier(), p.behaviouralVariable(), p.characteristic(), p.grounds(), p.warrant(), p.backing(), p.rebuttal()) if (p.__class__.__name__ == 'TaskCharacteristicParameters'): return TaskCharacteristic(objtId, p.task(), p.qualifier(), p.characteristic(), p.grounds(), p.warrant(), p.backing(), p.rebuttal()) if (p.__class__.__name__ == 'ImpliedProcessParameters'): return ImpliedProcess(objtId, p.name(), p.description(), p.persona(), p.network(), p.specification(), p.channels()) if (p.__class__.__name__ == 'LocationsParameters'): return Locations(objtId, p.name(), p.diagram(), p.locations(), p.links()) else: raise UnknownParameterClass(str(objtId))
from EvernoteController import EvernoteController from Memo import Memo MEMO_NAME = 'Memo' MEMO_DIR = 'Memo' MEMO_STORAGE_DIR = 'S-Memo' def f(fn, *args, **kwargs): try: fn(*args, **kwargs) except: pass m = Memo() e = EvernoteController() f(e.create_notebook, MEMO_DIR) f(e.create_notebook, MEMO_STORAGE_DIR) f(e.move_note, MEMO_DIR+'/'+MEMO_NAME, MEMO_STORAGE_DIR) e.create_note('Memo', m.raw_memo(), MEMO_DIR)
def timer(): import time import dbus.types assert _avail hints = {} hints['urgency'] = dbus.types.Byte(CRITICAL) if timer_soundfile.value != "": hints['sound-file'] = timer_soundfile.value notification_service.Notify( 'Memo', 0, # replaces_id, path.join(rox.app_dir, ".DirIcon"), # icon 'Time is up!', 'The Memo timer you set has expired.', [], hints, 0) # timeout if __name__ == '__main__': __builtins__._ = lambda x: x from Memo import Memo assert is_available() notify(Memo(0, 'This is a <message>.\nMore <details> go <here>.', True)) from rox import g g.main()
# python3 # -*- coding: utf-8 -*- import sys from Memo import Memo from PyQt5.QtWidgets import * if __name__ == '__main__': # 创建应用程序和对象 app = QApplication(sys.argv) memo = Memo() sys.exit(app.exec_())
from EvernoteController import EvernoteController from Memo import Memo MEMO_NAME = 'Memo' MEMO_DIR = 'Memo' MEMO_STORAGE_DIR = 'S-Memo' def f(fn, *args, **kwargs): try: fn(*args, **kwargs) except: pass m = Memo() e = EvernoteController() f(e.create_notebook, MEMO_DIR) f(e.create_notebook, MEMO_STORAGE_DIR) f(e.move_note, MEMO_DIR + '/' + MEMO_NAME, MEMO_STORAGE_DIR) e.create_note('Memo', m.raw_memo(), MEMO_DIR)