Пример #1
0
    def __init__(self):
        self.start_game_button = MainMenuState.main_menu_button(
            'start game',
            lambda: pygame.event.post(make_event(
                GameEvent.CHANGE_STATE,
                state=LevelState()
            ))
        )

        self.ai_button = MainMenuState.main_menu_button(
            'ai',
            lambda: print('click ai'),
        )

        self.quit_game_button = MainMenuState.main_menu_button(
            'quit game',
            lambda: pygame.event.post(pygame.event.Event(QUIT))
        )

        self.button_sprites: Union[pygame.sprite.Group, Iterable[Button]] = pygame.sprite.Group()
        self.button_sprites.add(self.start_game_button)
        self.button_sprites.add(self.ai_button)
        self.button_sprites.add(self.quit_game_button)

        self.button_layout = Layout(vpadding_inner=20)
        self.button_layout.add_all(self.button_sprites)
Пример #2
0
 def __init__(self, rows=2, cols=2):
     Element.__init__(self, gtk.Table(rows, cols))
     self.layout = Layout(0, 0)
     self.entry_rows = None
     self.entry_cols = None
     self.targets = {}
     self.child.set_row_spacings(3)
     self.child.set_col_spacings(3)
     self._resize_table(rows, cols)
Пример #3
0
 def __init__(self, app):
     
     self.__organisms = []
     self.__born = []
     self.__dead = []
     self.__sheeps = []
     self.__heracleums = []
     self.__organismsC = 0
     self.__start = False
     self.__changed = False
     self.__layout = Layout(self, app)
Пример #4
0
 def __init__(self, textbuffer=None, *args, **kwargs):
     if textbuffer is None:
         textbuffer = TextBuffer()
     gtk.TextView.__init__(self, textbuffer, *args, **kwargs)
     self.buffer = textbuffer
     self.anno_width = 200
     self.anno_padding = 10
     self.anno_layout = Layout(self)
     self.anno_views = {}
     self.show_annotations = True
     self.handle_links = True
     self.set_right_margin(50 + self.anno_padding)
     self.connect('map-event', self._on_map_event)
     self.connect('expose-event', self._on_expose_event)
     self.connect('motion-notify-event', self._on_motion_notify_event)
     self.connect('event-after', self._on_event_after)
     self.buffer.connect('mark-set', self._on_buffer_mark_set)
     self.buffer.connect('annotation-added', self._on_annotation_added)
     self.buffer.connect('annotation-removed', self._on_annotation_removed)
     self.set_wrap_mode(gtk.WRAP_WORD)
Пример #5
0
zM = 55  # Altitude du mât
zL = 0  # Altitude du Lidar

# Initialisation RWS_Sonic

R8, U8, V8, VL8 = [], [], [], []
tmptime = []
tmplidar = []
fig, axes = plt.subplots(1, 1, num="RWS_Sonic", figsize=(14, 14))
axes.set_xlabel("t (s)", fontsize=25)
axes.set_ylabel("RWS (m/s)", fontsize=20)
axes.set_title("Evolution de la vitesse radiale mesurée par l'anémomètre",
               fontsize=20)

xM, yM, xL, yL = Layout(path + "Work/",
                        False)  # Coordonnées du mât et du Lidar
plt.close("Layout")

for hour in range(1, n + 1):  # On parcourt les différents fichiers

    path1 = path0 + "151030" + str(hour) + ".I55"
    path2 = path0 + "WLS200s-15_radial_wind_data_2015-04-13_0" + str(
        hour) + "-00-00.csv"

    # Champs des vitesses

    try:
        U, V, W = ParseurSonique(path1)
        L = ParseurLidar(path2)
        L[0] %= 36000
    except FileNotFoundError:
Пример #6
0
    def loadDialog(self):
        home_folder = os.listdir('D:/')
        if not 'LayOutQC' in home_folder:
            os.mkdir('D:/LayOutQC/')
        if not '--INCOMING--' in home_folder:
            os.mkdir('D:/--INCOMING--/')
        self.load_name = QFileDialog.getOpenFileName(self, 'Open file', 'D:/LayOutQC/', "TIF files (*.tif)")[0]
        self.FileName = self.load_name.split("/")[-1]
        self.PathName = self.load_name[:len(self.load_name) - len(self.FileName)]
        if self.FileName:
            self.im = ImagePil.open(self.load_name)
            self.LayOutLoaded = True
            self.prw_name = 'temp/input_temp.png'
            self.comboTT_tables.setCurrentText(' ')
            self.comboTT_location.clear()
            self.comboTT_location.addItems([' '])
            self.comboTT_name.clear()
            self.comboTT_name.addItems([' '])
            self.comboTT_code.clear()
            self.comboTT_code.addItems([' '])
            self.TT_dismentions.setText('')
            self.CheckTT_act.setEnabled(False)
            self.Show_input_act.setIcon(self.icon4)
            self.Show_input_act.setEnabled(False)
            self.TopZone_act.setEnabled(False)
            files = glob.glob('temp/*')
            for f in files:
                os.remove(f)

            # Runing Layout Module
            self.layout = Layout(self.im)
            self.layout._DEBAG(LayoutQC_DEBAG)

            #  set Layout info into Toolbar
            self.modeToolbar.setStyleSheet(self.layout.layout_mode_status())
            self.iccToolbar.setStyleSheet(self.layout.layout_profile_status())

            self.modeToolbar.setText(self.layout.image.mode)
            self.resToolbar.setText(str(self.layout.resolution))
            self.dismX.setText(str(self.layout.width_layout) + 'mm')
            self.dismY.setText(str(self.layout.height_layout) + 'mm')
            self.iccToolbar.setText(self.layout.layout_profile_name())

            # make $ showing preview
            self.layout.make_prw(self.prw_name, LayoutQC_DEBAG=LayoutQC_DEBAG)


            # self.im222=QPixmap(self.prw_name)


            # self.scaleFactor = 1.0
            # show_x = self.desktop.width() - 270
            # show_y = show_x / self.im.size[0] * self.im.size[1]
            # if show_y > self.desktop.height() - 200:
            #     show_y = self.desktop.height() - 200
            #     show_x = show_y / self.im.size[1] * self.im.size[0]

            width_central_widget = self.desktop.width() - 222
            height_central_widget = self.desktop.width() - 178
            if self.im.size[0] > self.im.size[1]:
                self.zoom = width_central_widget / self.im.size[0]
            else:
                self.zoom = height_central_widget / self.im.size[1]

            self.scene.clear()
            self.scene.addPixmap(QPixmap(self.prw_name))
            self.updateView()

            print(self.desktop.width())
            print(self.desktop.height())


            self.AutoSelectTT_act.setEnabled(True)
            self.tables = self.layout.layout_db_tabeles
            self.comboTT_tables.addItems(self.tables)
            self.name_Layout()
Пример #7
0
zM = 75  # Altitude du mât
zL = 0  # Altitude du Lidar

# ---------- Représentations ----------

plt.close('all')

# Disposition du parc éolien

rep = builtins.input(
    "Do you wish to display the layout of the windfarm (Y/N) ? ")

if rep.upper() == "Y" or rep.upper(
) == "O":  # O pour ceux qui voudraient dire oui
    xM, yM, xL, yL = Layout(path + "Work/", True)
else:
    xM, yM, xL, yL = Layout(path + "Work/", False)
    plt.close("Layout")

# Maillage

rep = builtins.input(
    "Do you wish to display the grid of the points measured by the Lidar (Y/N) ? "
)

if rep.upper() == "Y" or rep.upper() == "O":
    sav = builtins.input("Do you wish to save it (Y/N) ? ")
    n = builtins.input(
        "Number of points (Recommended : 800) : ")  # 800 c'est pas mal
    t = builtins.input(
Пример #8
0
        self.step = self.step + 1

    def decStep(self):
        """
            Decrease current step by one.
        """
        if self.step <= 0:
            raise RuntimeError("Step number has already been zero")
        self.step = self.step - 1

    def setStep(self, num):
        """
            Step step number.
        """
        if num < 0:
            raise ValueError("Step number less than zero")
        self.step = num


if __name__ == '__main__':
    from Layout import Layout
    chessBoard = ChessBoard()
    l = Layout(0)
    l.setToDefault()
    chessBoard.copyFromLayout(0, l)
    mv0 = Movement(0, 29, 23, Result.RES_WIN)
    mv1 = Movement(1, 23, 17, Result.RES_WIN)
    print(chessBoard.move(mv0))
    print(chessBoard.move(mv1))
    print(chessBoard)
Пример #9
0
	def __getattr__(self, name):
		return getattr(self._args, name)

parser = FriendlyArgumentParser()
parser.add_argument("--datadir", metavar = "path", type = str, default = None, help = "Specifies directory in which the data files are located. Defaults to data/ relative to executable.")
parser.add_argument("-g", "--game", choices = [ "mahjong", "shisen" ], default = "mahjong", help = "Specifies which game to play")
parser.add_argument("-t", "--tileset", metavar = "name", default = "default", help = "Name of the tileset to use. Defaults to %(default)s")
parser.add_argument("-l", "--layout", metavar = "name", help = "Name of the board layout to use.")
parser.add_argument("-s", "--seed", metavar = "seed", type = int, help = "Seed of the game to use. Randomly chosen if omitted.")
parser.add_argument("--texresolution", metavar = "res", type = int, default = 512, help = "Specify texture resolution that should be used. Default is %(default)s.")
parser.add_argument("--allow-unsolvable", action = "store_true", default = False, help = "Allow non-solvable board layouts.")
args = parser.parse_args(sys.argv[1:])

config = Configuration(args)
layout = Layout(config.layoutfile)
tileset = TileSet(config.tilesetfile)
if args.game == "mahjong":
	board = MahjongBoard(layout.gridlen)
elif args.game == "shisen":
	board = ShisenBoard()
else:
	raise Exception(NotImplemented)
game = Game(config, layout, tileset, board)
game.new()

display = OpenGLDisplay()

gamecontroller = GameController(args, game, display)