Esempio n. 1
0
 def __init__(self):
     super().__init__()
     self.slot = [
         State.Slot(Root.size[0] / 2 - 100, Root.size[1] / 2),
         ]
     self.menu = [
         State.Input(self.slot[0].x, self.slot[0].y, '', self.go_back)
     ]
Esempio n. 2
0
 def __init__(self):
     super().__init__()
     self.slot = [
         State.Slot(Root.size[0] / 2 - 100, Root.size[1] / 2),
         State.Slot(Root.size[0] / 2 - 100, Root.size[1] / 2 + 30)
     ]
     self.menu = [
         State.Input(self.slot[0].x, self.slot[0].y, '시작하기', self.start),
         State.Input(self.slot[1].x, self.slot[1].y, '만든 사람들', self.credit)
     ]
     self.pointer = State.Pointer(self.slot[self.place].x, self.slot[self.place].y)
Esempio n. 3
0
File: Sharm.py Progetto: skpzk/Sharm
	def __init__(self):

		State().read()

		self.audio = Audio()

		audioPatch = AudioPatch()
		self.audioPatch = audioPatch
		self.audio.setAudioObject(audioPatch.output())
		self.audio.setClock(audioPatch.clock)

		State().params['patchbay'].setCallback(audioPatch.patchbay)
Esempio n. 4
0
def frames():
    from FigureNumber import FigureNumber
    from state.State import State
    from state.Model import Model
    from state.Reaction import Reaction
    from state.Species import Species
    from state.SpeciesReference import SpeciesReference
    from state.Histogram import Histogram
    from state.HistogramFrames import HistogramFrames

    # Figure number.
    figureNumber = FigureNumber()

    # A histogram.
    numberOfBins = 4
    multiplicity = 2
    h = Histogram(numberOfBins, multiplicity)
    h.setCurrentToMinimum()
    h.accumulate(0, 1)
    h.accumulate(1, 2)
    h.accumulate(2, 2)
    h.accumulate(3, 1)

    # Simulation output.
    frameTimes = [0, 1]
    recordedSpecies = [0, 1, 2]
    hf = HistogramFrames(numberOfBins, multiplicity, recordedSpecies)
    hf.setFrameTimes(frameTimes)
    for i in range(len(frameTimes)):
        for j in range(len(recordedSpecies)):
            hf.histograms[i][j].merge(h)

    # The model.
    model = Model()
    model.speciesIdentifiers = ['s1', 's2', 's3']

    # The state.
    state = State()
    state.models['model'] = model
    state.output[('model', 'method')] = hf

    app = wx.PySimpleApp()
    TestConfiguration(None, 'Populations.', state, figureNumber).Show()
    app.MainLoop()
Esempio n. 5
0
def average():
    from FigureNumber import FigureNumber
    from state.State import State
    from state.Model import Model
    from state.Reaction import Reaction
    from state.Species import Species
    from state.SpeciesReference import SpeciesReference
    from state.Histogram import Histogram
    from state.HistogramAverage import HistogramAverage

    # Figure number.
    figureNumber = FigureNumber()

    # A histogram.
    numberOfBins = 4
    multiplicity = 2
    h = Histogram(numberOfBins, multiplicity)
    h.setCurrentToMinimum()
    h.accumulate(0, 1)
    h.accumulate(1, 2)
    h.accumulate(2, 2)
    h.accumulate(3, 1)

    # Simulation output.
    recordedSpecies = [0, 1, 2]
    output = HistogramAverage(numberOfBins, multiplicity, recordedSpecies)
    for x in output.histograms:
        x.merge(h)

    # The model.
    model = Model()
    model.speciesIdentifiers = ['s1', 's2', 's3']

    # The state.
    state = State()
    state.models['model'] = model
    state.output[('model', 'method')] = output

    app = wx.PySimpleApp()
    TestConfiguration(None, 'Populations.', state, figureNumber).Show()
    app.MainLoop()
Esempio n. 6
0
def main():
    from FigureNumber import FigureNumber
    from state.StatisticsFrames import StatisticsFrames
    from state.State import State
    from state.Model import Model

    #from state.Reaction import Reaction

    class TestConfiguration(wx.Frame):
        """Test the Configuration panel."""
        def __init__(self, parent, title, state, figureNumber):
            wx.Frame.__init__(self, parent, -1, title)
            panel = Configuration(self, state, figureNumber)

            bestSize = self.GetBestSize()
            # Add twenty to avoid an unecessary horizontal scroll bar.
            size = (bestSize[0] + 80, min(bestSize[1], 700))
            self.SetSize(size)
            self.Fit()

    app = wx.PySimpleApp()
    figureNumber = FigureNumber()

    s = ['a', 'b', 'c']
    t = StatisticsFrames([0, 1, 2])
    t.setFrameTimes([0, 1, 2])
    t.setStatistics([1, 0.1, 2, 0.2, 3, 0.3] * 3)
    state = State()
    # Set the species identifiers.
    modelId = state.insertNewModel()
    model = state.models[modelId]
    model.id = modelId
    model.speciesIdentifiers = s
    # Dummy reactions.
    #model.reactions = [Reaction(_id, '', [], [], True, '0') for _id in r]
    # Store the trajectories.
    state.output[(modelId, 'method')] = t
    TestConfiguration(None, 'Populations.', state, figureNumber).Show()

    app.MainLoop()
Esempio n. 7
0
 def __init__(self):
     super().__init__()
     self.slot = [
         State.Slot(Root.size[0] / 2 - 100, Root.size[1] / 2),
         State.Slot(Root.size[0] / 2 - 100, Root.size[1] / 2 + 30),
         State.Slot(Root.size[0] / 2 - 100, Root.size[1] / 2 + 60)
     ]
     self.menu = [
         State.Input(self.slot[0].x, self.slot[0].y, '다시하기', self.restart),
         State.Input(self.slot[1].x, self.slot[1].y, '메인화면으로', self.start_screen),
         State.Input(self.slot[2].x, self.slot[2].y, '끝내기', self.end)
     ]
     self.pointer = State.Pointer(self.slot[self.place].x, self.slot[self.place].y)
Esempio n. 8
0
    def show_actions(self, text1, text2, text3, text4):
        self.slot = [
            State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50),
            State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 2),
            State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 3),
            State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 4),
            State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 5)
        ]

        self.place = 0
        self.show_action = True
        self.pointer = 0
        self.menu = [
            State.Input(self.slot[0].x, self.slot[0].y, text1,
                        self.getover_turn),
            State.Input(self.slot[1].x, self.slot[1].y, text2,
                        self.getover_turn),
            State.Input(self.slot[2].x, self.slot[2].y, text3,
                        self.getover_turn),
            State.Input(self.slot[3].x, self.slot[3].y, text4,
                        self.getover_turn),
        ]
Esempio n. 9
0
    def open_magic_menu(self):
        self.place = 0

        if Root.turn and not self.player1_choose:
            Sp.random_spell(self.player1)
            self.player1_choose = True
        elif not Root.turn and not self.player2_choose:
            Sp.random_spell(self.player2)
            self.player2_choose = True

        if Root.turn:
            self.menu = [
                State.Input(self.slot[0].x, self.slot[0].y,
                            self.player1.spell_list[0].name, self.use_spell),
                State.Input(self.slot[1].x, self.slot[1].y,
                            self.player1.spell_list[1].name, self.use_spell),
                State.Input(self.slot[2].x, self.slot[2].y,
                            self.player1.spell_list[2].name, self.use_spell),
                State.Input(self.slot[3].x, self.slot[3].y,
                            self.player1.spell_list[3].name, self.use_spell),
                State.Input(self.slot[4].x, self.slot[4].y, '돌아가기', self.init)
            ]

        else:
            self.menu = [
                State.Input(self.slot[0].x, self.slot[0].y,
                            self.player2.spell_list[0].name, self.use_spell),
                State.Input(self.slot[1].x, self.slot[1].y,
                            self.player2.spell_list[1].name, self.use_spell),
                State.Input(self.slot[2].x, self.slot[2].y,
                            self.player2.spell_list[2].name, self.use_spell),
                State.Input(self.slot[3].x, self.slot[3].y,
                            self.player2.spell_list[3].name, self.use_spell),
                State.Input(self.slot[4].x, self.slot[4].y, '돌아가기', self.init)
            ]

        self.pointer = State.Pointer(self.slot[self.place].x,
                                     self.slot[self.place].y)
Esempio n. 10
0
    def init(self):
        self.place = 0
        if not Root.turn:
            self.slot = [
                State.Slot(Root.size[0] / 16 + Root.size[0] / 2,
                           Root.size[1] / 2 + 50),
                State.Slot(Root.size[0] / 16 + Root.size[0] / 2,
                           Root.size[1] / 2 + 50 * 2),
                State.Slot(Root.size[0] / 16 + Root.size[0] / 2,
                           Root.size[1] / 2 + 50 * 3),
                State.Slot(Root.size[0] / 16 + Root.size[0] / 2,
                           Root.size[1] / 2 + 50 * 4),
                State.Slot(Root.size[0] / 16 + Root.size[0] / 2,
                           Root.size[1] / 2 + 50 * 5)
            ]
        else:
            self.slot = [
                State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50),
                State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 2),
                State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 3),
                State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 4),
                State.Slot(Root.size[0] / 16, Root.size[1] / 2 + 50 * 5)
            ]

        self.menu = [
            State.Input(self.slot[0].x, self.slot[0].y, '기본 공격',
                        self.basic_atk),
            State.Input(self.slot[1].x, self.slot[1].y, '스킬',
                        self.open_magic_menu),
            State.Input(self.slot[2].x, self.slot[2].y, '마나 회복',
                        self.recover_mp)
        ]
        self.pointer = State.Pointer(self.slot[self.place].x,
                                     self.slot[self.place].y)
Esempio n. 11
0
 def checkState(self):
     for inppName, value in State().params['patchbay'].items():
         for outppName in value:
             self.newPcFromPpNames(inppName, outppName)
Esempio n. 12
0
def main():
    from state.TimeSeriesFrames import TimeSeriesFrames
    from state.TimeSeriesAllReactions import TimeSeriesAllReactions
    from state.State import State
    from state.Model import Model
    from state.Reaction import Reaction
    from state.Species import Species
    from state.SpeciesReference import SpeciesReference

    app = wx.PySimpleApp()

    # Many species.
    s = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
         'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
         's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    r = ['r1', 'r2', 'r3', 'r4']
    t = TimeSeriesFrames()
    t.setFrameTimes([0, 1, 2])
    t.recordedSpecies = range(len(s))
    t.recordedReactions = range(len(r))
    t.appendPopulations([1]*len(s) + [2]*len(s) + [3]*len(s))
    t.appendReactionCounts([0]*len(r) + [2]*len(r) + [4]*len(r))
    t.appendPopulations([2]*len(s) + [3]*len(s) + [5]*len(s))
    t.appendReactionCounts([0]*len(r) + [3]*len(r) + [6]*len(r))
    state = State()
    # Set the species identifiers.
    modelId = state.insertNewModel()
    model = state.models[modelId]
    model.id = modelId
    model.speciesIdentifiers = s
    # Dummy reactions.
    model.reactions = [Reaction(_id, '', [], [], True, '0') for _id in r]
    # Store the trajectories.
    state.output[(modelId, 'method')] = t
    Export(None, 'Populations.', state).Show()
    
    s = ['a', 'b', 'c']
    r = ['r1', 'r2', 'r3', 'r4']
    t = TimeSeriesFrames()
    t.setFrameTimes([0, 1, 2])
    t.recordedSpecies = range(len(s))
    t.recordedReactions = range(len(r))
    t.appendPopulations([1]*len(s) + [2]*len(s) + [3]*len(s))
    t.appendReactionCounts([0]*len(r) + [2]*len(r) + [4]*len(r))
    t.appendPopulations([2]*len(s) + [3]*len(s) + [5]*len(s))
    t.appendReactionCounts([0]*len(r) + [3]*len(r) + [6]*len(r))
    state = State()
    # Set the species identifiers.
    modelId = state.insertNewModel()
    model = state.models[modelId]
    model.id = modelId
    model.speciesIdentifiers = s
    # Dummy reactions.
    model.reactions = [Reaction(_id, '', [], [], True, '0') for _id in r]
    # Store the trajectories.
    state.output[(modelId, 'method')] = t
    Export(None, 'Populations.', state).Show()

    initialTime = 0.
    finalTime = 1.
    t = TimeSeriesAllReactions([0, 1], [0, 1], initialTime, finalTime)
    t.appendIndices([0])
    t.appendTimes([0.5])
    t.appendInitialPopulations([13, 17])
    state = State()
    # Set the species identifiers.
    modelId = state.insertNewModel()
    model = state.models[modelId]
    model.id = modelId
    model.speciesIdentifiers.append('s1')
    model.species['s1'] = Species('C1', 'species 1', '13')
    model.speciesIdentifiers.append('s2')
    model.species['s2'] = Species('C1', 'species 2', '17')
    model.reactions.append(
        Reaction('r1', 'reaction 1', [SpeciesReference('s1')], 
                 [SpeciesReference('s2')], True, '1.5'))
    model.reactions.append(
        Reaction('r2', 'reaction 2', 
                 [SpeciesReference('s1'), SpeciesReference('s2')], 
                 [SpeciesReference('s1', 2)], True, '2.5'))
    # Store the trajectories.
    state.output[(modelId, 'method')] = t
    Export(None, 'Populations.', state).Show()

    app.MainLoop()
Esempio n. 13
0
File: Sharm.py Progetto: skpzk/Sharm
	def close(self):
		State().save()
		self.audio.stop()
Esempio n. 14
0
def main():
    import os
    from state.TimeSeriesFrames import TimeSeriesFrames
    from state.TimeSeriesAllReactions import TimeSeriesAllReactions
    from state.State import State
    from state.Model import Model
    from state.Reaction import Reaction
    from state.Species import Species
    from state.SpeciesReference import SpeciesReference

    class TestConfiguration(wx.Frame):
        """Test the Configuration panel."""
        def __init__(self, parent, title, state):
            wx.Frame.__init__(self, parent, -1, title)
            panel = Configuration(self, state)

            bestSize = self.GetBestSize()
            # Add twenty to avoid an unecessary horizontal scroll bar.
            size = (bestSize[0] + 80, min(bestSize[1], 700))
            self.SetSize(size)
            self.Fit()

    app = wx.PySimpleApp()

    # Many species.
    s = [
        'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
        'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
    ]
    r = ['r1', 'r2', 'r3', 'r4']
    t = TimeSeriesFrames()
    t.setFrameTimes([0, 1, 2])
    t.recordedSpecies = range(len(s))
    t.recordedReactions = range(len(r))
    t.appendPopulations([1] * len(s) + [2] * len(s) + [3] * len(s))
    t.appendReactionCounts([0] * len(r) + [2] * len(r) + [4] * len(r))
    t.appendPopulations([2] * len(s) + [3] * len(s) + [5] * len(s))
    t.appendReactionCounts([0] * len(r) + [3] * len(r) + [6] * len(r))
    state = State()
    # Set the species identifiers.
    modelId = state.insertNewModel()
    model = state.models[modelId]
    model.id = modelId
    model.speciesIdentifiers = s
    # Dummy reactions.
    model.reactions = [Reaction(_id, '', [], [], True, '0') for _id in r]
    # Store the trajectories.
    state.output[(modelId, 'method')] = t
    TestConfiguration(None, 'Time series frames.', state).Show()

    s = ['a', 'b', 'c']
    r = ['r1', 'r2', 'r3', 'r4']
    t = TimeSeriesFrames()
    t.setFrameTimes([0, 1, 2])
    t.recordedSpecies = range(len(s))
    t.recordedReactions = range(len(r))
    t.appendPopulations([1] * len(s) + [2] * len(s) + [3] * len(s))
    t.appendReactionCounts([0] * len(r) + [2] * len(r) + [4] * len(r))
    t.appendPopulations([2] * len(s) + [3] * len(s) + [5] * len(s))
    t.appendReactionCounts([0] * len(r) + [3] * len(r) + [6] * len(r))
    state = State()
    # Set the species identifiers.
    modelId = state.insertNewModel()
    model = state.models[modelId]
    model.id = modelId
    model.speciesIdentifiers = s
    # Dummy reactions.
    model.reactions = [Reaction(_id, '', [], [], True, '0') for _id in r]
    # Store the trajectories.
    state.output[(modelId, 'method')] = t
    TestConfiguration(None, 'Time series frames.', state).Show()

    initialTime = 0.
    finalTime = 1.
    t = TimeSeriesAllReactions([0, 1], [0, 1], initialTime, finalTime)
    t.appendIndices([0])
    t.appendTimes([0.5])
    t.appendInitialPopulations([13, 17])
    state = State()
    # Set the species identifiers.
    modelId = state.insertNewModel()
    model = state.models[modelId]
    model.id = modelId
    model.speciesIdentifiers.append('s1')
    model.species['s1'] = Species('C1', 'species 1', '13')
    model.speciesIdentifiers.append('s2')
    model.species['s2'] = Species('C1', 'species 2', '17')
    model.reactions.append(
        Reaction('r1', 'reaction 1', [SpeciesReference('s1')],
                 [SpeciesReference('s2')], True, '1.5'))
    model.reactions.append(
        Reaction('r2', 'reaction 2',
                 [SpeciesReference('s1'),
                  SpeciesReference('s2')], [SpeciesReference('s1', 2)], True,
                 '2.5'))
    # Store the trajectories.
    state.output[(modelId, 'method')] = t
    TestConfiguration(None, 'Time series all reactions.', state).Show()

    app.MainLoop()