def __init__(self): super(Imageloader, self).__init__() self.resultDir = "../Analyze_results/Images/" self.w = wg.Widget() self.setCentralWidget(self.w) self.createActions() self.createMenus() self.directory = "" self.setWindowTitle("ZebraFish Analyzer") self.resize(800, 640)
def setUI(self): self.toolbar = tb.Toolbar(self) self.main = wid.Widget() self.toolbar.set_main(self.main) self.main.set_toolbar( self.toolbar) #dock widgetlerin açıp kapamak için self.toolbar.SetNewsDock(self.main.tools, self.main.codes, self.main.object) self.toolbar.DefaultObject() self.setCentralWidget(self.main)
def locate(self, state, observer, env): targets = [] if use_onepass: if self.tag in state.get('guess_items'): # TODO: select one from the classification results #itemid = state.get('guess_items')[self.tag][0] for itemid in state.get('guess_items')[self.tag]: target = widget.Widget(state.get('tree'), itemid) targets.append(target) else: for itemid in observer.find_elements(state, self.tag): target = widget.Widget(state.get('tree'), itemid) targets.append(target) target = targets[0] if targets != [] else None exoverride = value.get_exlocator(state.get('screen'), self.tag) if exoverride is not None: logger.info("using overrided exlocator for %s %s", state.get('screen'), self.tag) for marker in exoverride: ret = marker.locate(state, observer, env) if ret is not None: value.mark_locator(marker, ret[0], target) return ret return [] override = value.get_locator(self.tag) if override is not None: logger.info("using overrided locator for %s", self.tag) for marker in override: ret = marker.locate(state, observer, env) if ret is not None: value.mark_locator(marker, ret[0], target) return ret return [] return targets
def main(): logging.basicConfig( level=logging. DEBUG, # CRITICAL > ERROR > WARNING > INFO > DEBUG > NOTSET format='%(asctime)s [line:%(lineno)d] [%(levelname)s] %(message)s', filename='logger.log', filemode='w') # 每次真正import logging之后,filemode为w就会清空内容 w = widget.Widget() m = menu.Menu() # 菜单界面 restart = True if m.main(): while restart: g = engin.Game() # 游戏主逻辑 restart = g.main() del g # engin.test_calc_frame_cost() del w
def startup(self, item, index=None): index = index if index != None else item.sellected DECODER = json.JSONDecoder() with open(item.odata.widgets[index].path) as f: decode_s = DECODER.decode(f.read()) if (decode_s.get("widget") != None): drawer = os.path.join(item.odata.dir, str(index) + ".py") drawername = ".py" if (decode_s.get("widget").get("drawer") != None): drawer = os.path.join(item.odata.dir, decode_s.get("widget").get("drawer")) drawername = decode_s.get("widget").get("drawer") settings = Settings(None, None, item.odata.name, None) if (decode_s.get("widget").get("default") != None): settings = Settings( decode_s.get("widget").get("default").get("width"), decode_s.get("widget").get("default").get( "height"), item.odata.name, decode_s.get("widget").get("default").get( "origin")) item.active.append(index) item.wid = item.odata.uid self.items["d_tools"].update() try: w = widget.Widget(decode_s.get("widget"), drawer, drawername, settings, self, item.odata.uid + "#" + str(index)) s = item.odata.widgets[index].getSettings() if (s.get("x") != None and s.get("y") != None): w.move(s["x"], s["y"]) self.active_w.append(w) except: self.setStatus("st_initialisation_error") else: self.setStatus("st_initialisation_error")
def find_scroll_target(state): tree = state.get('tree') cand = [] for itemid in tree: if tree[itemid]['scroll']: cand.append(itemid) if len(cand) == 1: target = cand[0] elif len(cand) == 0: return None else: # TODO: pick from all those scrollable? max_size = -1 target = None for itemid in cand: size = tree[itemid]['origw'] * tree[itemid]['origh'] if size > max_size: max_size = size target = itemid target = widget.Widget(tree, target) return target
def follow_path(self, tree, nodeid): if self.path is not None: for segment in path_segment_re.findall(self.path): node = tree[nodeid] (direction, count) = segment count = int(count) if direction == 'P': for i in range(count): nodeid = node['parent'] elif direction == 'C': nodeid = node['children'][count] elif direction == 'L' or direction == 'R': parent = node['parent'] for xnum in range(len(tree[parent]['children'])): if tree[parent]['children'][xnum] == nodeid: if direction == 'L': nodeid = tree[parent]['children'][xnum - 1] else: nodeid = tree[parent]['children'][xnum + 1] break return widget.Widget(tree, nodeid)
def main(self): rect = widget.Widget((100,100,300,200)) self.widgets['rect'] = rect self.layers.append(rect)
class mw: def show(self): print("-1") if not QApplication.instance(): app = QApplication(sys.argv) else: app = QApplication.instance() WORKPATH = sys.argv[1] WORKPATH = WORKPATH if WORKPATH[len(WORKPATH) - 1] == "/" or WORKPATH[ len(WORKPATH) - 1] == "\\" else WORKPATH + "/" WIDGET = WORKPATH + "widget.json" DRAWER = WORKPATH + "drawer.py" decode_s = None with open(WIDGET, "r") as widget: decode_s = json.loads(widget.read()) if ("widget" in decode_s): DRAWER = WORKPATH + decode_s["widget"]["drawer"] if (os.path.exists(DRAWER)): wd.Widget(decode_s.get("widget"), DRAWER, "drawer", Settings(400, 400, "Runner", decode_s["widget"].get("origin")), mw(), "test-" + str(uuid.uuid4())) else: raise Exception("Missing drawer file! " + DRAWER) sys.exit(app.exec_())
#canvas.py #widget.py #game.py #rules.py #search.py #point.py #piece.py import board import canvas import widget import game if __name__ == "__main__": settings = widget.Widget() settings.main_loop() #if cancel_button pressed then don't start game if not settings.cancel_button_pressed() == True: #configure game setting choice = settings.get_game() turn = settings.get_turn() row = int(settings.get_row()) column = int(settings.get_column()) game_mode = settings.get_game() first_turn = settings.get_turn() board = board.Board(row, column) board.game_settings() #start game game = game.Game(board, game_mode, first_turn) game.initialize()
self.choose_course_window.show() self.choose_course_window.choose_course_signal.connect(self.choose_course_get_info) @Slot() def choose_course_get_info(self, info): self.choose_course_info = info print(self.choose_course_info) @Slot() def advanced_sort_get_info(self, info): self.ad_course_info = info # print(self.ad_course_info) self.widget.fill_table() for course in info: item = self.widget.table.findItems(course, Qt.MatchExactly) self.widget.table.item(item[0].row(), 1).setText(str(info[course])) item = self.widget.table.findItems("0", Qt.MatchExactly) for obj in item: self.widget.table.removeRow(self.widget.table.indexFromItem(obj).row()) self.widget.table.sortItems(1, Qt.AscendingOrder) if __name__ == "__main__": app = QApplication(sys.argv) widget = widget.Widget() window = MainWindow(widget) window.resize(800, 600) window.show() sys.exit(app.exec_())